143963: AtomikosDataSourceBean: add "supportsTmJoin" config option so TMJOIN can be disabled
A specific usage pattern of our datasource (ds) may involve:
//start transaction Connection c = ds.getConnection(); //DB Access 1: do stuff c.close() c = ds.getConnection(); //DB Access 2: do more stuff c.close() //commit transaction
By default, DB Access 2 will reuse the XA branch started by DB Access 1, via the TMJOIN flag (XA-specific). It should be possible to disallow TMJOIN and connection recycling when the database does not support it (like SQLServer).
The connection pool can retrieve/check this from the configured datasource properties before deciding to recycle a connection. This will effectively avoid TMJOIN, and DB Access 2 will use a new, different XA branch.
Highlights for how to make this work with SQLServer in terms of AtomikosDataSourceBean setup:
ds.setStartNewXaBranchFlags(SQLServerXAResource.SSTRANSTIGHTLYCPLD); ds.setSupportsTmJoin(false);