added a check for roll-back-only condition, however, we should first check for active JTA transaction. The reason is that when Hibernate ORM calls accessTransaction().getRollbackOnly(), an ISE exception is immediately thrown by org.hibernate.engine.transaction.internal.TransactionImpl.getRollbackOnly, which is confusing to users, as they called EntityManager.find(), which shouldn't throw "IllegalStateException: JPA compliance dictates throwing IllegalStateException when #getRollbackOnly is called on non-active transaction", as the application didn't call #getRollbackOnly.
I suggest a change from:
Change instead to:
I'll try the above change locally and check if the current ORM testsuite still passes (on ORM master branch).
I marked this bug as minor, as I think that reflects it having minor impact but at the same time is highly annoying, due to the confusion it causes the user (as to why they are getting the exception about "#getRollbackOnly", when they only called EntityManager.find().
I verified that this code change didn't seem to cause any (additional) tests to fail. Will push the change to get CI feedback.
I’m not sure if this will work in all cases. I’m going to have to move it to 5.3.13, and look into it further.
Fixed in master.
Fixed in 5.3 branch as well.