Hi,
I'm successfully using JTA with Hibernate to synchronise concurrent writes to multiple sessions in multiple databases. Things are working fine, but I have a question regarding the Connection Release Mode.
I've read in several distinct places that when using JTA and XADatasources, one should the "
after_statement" connection release mode. This is also enforced by the JTASessionContext. Everywhere I read that one should use this aggressive release mode, but nowhere I find the rationale. Why do we need to use this? There's an impact on performance when making lots of requests (bulk inserts for example).
A few quotes from the Hibernate documentation:
Quote:
after_transaction: uses ConnectionReleaseMode.AFTER_TRANSACTION. This setting should not be used in JTA environments.
Quote:
For an application server JTA datasource, use after_statement to aggressively release connections after every JDBC call.
I tried both
after_transaction and
after_statement and both work well under my test case, although after_transaction if faster. Obviously, I don't want to use
after_transaction if it can have serious side-effects. Can someone point me to a detailed explanation of why we must use
after_statement? Please don't spare any technical details, I'd really like to fully understand this.
Cheers,
Philippe