HHH-6599 Hibernate mark as rollback even for no transaction requests

This commit is contained in:
Strong Liu 2011-08-30 18:39:12 +08:00
parent 71bca205e9
commit 0dbc756093
2 changed files with 5 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
# Typically *NIX text editors, by default, append '~' to files on saving to make backups
*~
.DS_Store
# Gradle work directory
.gradle

View File

@ -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 );