org.hibernate.jpa.spi.AbstractEntityManagerImpl.joinTransaction(boolean explicitRequest) used to check if a transaction is active and throw a TransactionRequiredException if not. We seemed to lose that with the HHH-9747 change. Old code: {code} if ( transaction.getJoinStatus() == JoinStatus.NOT_JOINED ) { if ( explicitRequest ) { throw new TransactionRequiredException( "No active JTA transaction on joinTransaction call" ); } else { LOG.debug( "Unable to join JTA transaction" ); return; } {code}
Javadoc for EntityManager.joinTransaction () description from JPA 2.1 spec : {quote} void joinTransaction() /** * Indicate to the entity manager that a JTA transaction is * active. This method should be called on a JTA application * managed entity manager that was created outside the scope * of the active transaction or on an entity manager of type * SynchronizationType.UNSYNCHRONIZED to associate it with the * current JTA transaction. Throws: * @throws TransactionRequiredException - if there is * no transaction */ public void joinTransaction(); {quote} As mentioned on IRC, I think there are some cases that we allow explicit joinTransaction calls to not throw the exception (e.g. non-jta entity manager).
|