public Transaction getTransaction() throws HibernateException {
if (isClosed() ) {
return null
}
if ( getFactory().getSessionFactoryOptions().getJpaCompliance().isJpaTransactionComplianceEnabled() ) {
if ( getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta() ) {
if ( !getFactory().getSessionFactoryOptions().isJtaTransactionAccessEnabled() ) {
throw new IllegalStateException( "A JTA EntityManager cannot use getTransaction()" );
}
}
}
return accessTransaction();
}