Affects Version/s: 3.1.1_b12, 3.1.1
Fix Version/s: None
I had an issue where JDBC connections were in autoCommit mode even though a JTA transaction was in progress, effectively breaking the transaction's ability to roll back.
The trigger for this condition was editing domain.xml - I had edited the JNDI name for my connection pool (<jdbc-resource>) in domain.xml without changing the corresponding <server>/<resource-ref> element. Unfortunately, JPA was still able to find my connection pool, but the returned connections were in autoCommit mode and didn't participate in the transaction.
Steps to reproduce:
1. Set up a JNDI datasource jdbc/TEST through the admin UI and run the below test() method via attached JSF page or other CDI mechanism - will print "ok, autoCommit = false"
2. Edit domain.xml, change <resource-ref ref="jdbc/TEST"> to jdbc/TEST2 or something like that.
3. Restart Glassfish and try again - will print "problem – autoCommit = true, should be false!"
Sample code attached.