Quote:
Why? Why should the connection be released after statement execution and not at the end of a transaction?
Because JTA does not call beforeTransactionCompletion() if the transaction is being rolled back, and so there would be no chance to close the connection.
Quote:
And what happens with the connection obtained via session.connection() call when this setting is used?
I must admit I never really thought about it. I assumed that in a CMT/JCA environment, you just obtain the connection the normal way via the Datasource. JCA guarantees it is the same underlying connection Hibernate is using.
However, I can see in your other post that if you
do get the Connection via Session.connection(), you have a problem releasing it. We'll have to change the impl of Session.connection() when release_mode=after_statement.
The workaround, of course, is to get the connection in the standard J2EE way....