diff --git a/.gitignore b/.gitignore index fec3c42561..4af27c627a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Typically *NIX text editors, by default, append '~' to files on saving to make backups *~ +.DS_Store # Gradle work directory .gradle diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java index a7a5d1b89c..879a2cce13 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java @@ -54,6 +54,7 @@ import javax.transaction.Status; import javax.transaction.Synchronization; import javax.transaction.SystemException; import javax.transaction.TransactionManager; +import javax.transaction.Status; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -1124,7 +1125,9 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage ); } try { - transactionManager.setRollbackOnly(); + if ( transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION ) { + transactionManager.setRollbackOnly(); + } } catch ( SystemException e ) { throw new PersistenceException( "Unable to set the JTA transaction as RollbackOnly", e );