Feature #885
Support more DataSource flags w.r.t JTA
0%
Description
Currently, the default is the enlist in the work unit (and hence re-use along the workunit) or not at all.
Enlisting in the workunit "transparently" integrates with JTA. But sometimes this is not desired as the current behavior may create long-running transactions unintendedly (just some activity outside of a JTA tx).
It would hence be nice to support the following additional behaviors:
a) Require JTA transaction present ("JTA transaction required")
This is useful, if you really want to manage transaction demarcation and fail hard, if there is none.
b) Enlist in workunit if there is a JTA tx, otherwise return an autocommit connection ("JTA supported")
This is useful, if you are ok with non-TX stuff but still want to have control over TX demarcation.
Now a) has a downside: Some utilities (e.g. flyway, quartz) can be used with JNDI data sources but will not integrate with JTA.
For those exceptional cases, the data source lookup could be performed with a specialized marker interface (?type=...NonJTARequiringDatasource, ?type=JTAOptionalizingDatasource etc).