HHH-6588 rollback to use "org.hibernate.SQL" category to log sql

This commit is contained in:
Strong Liu 2011-08-30 18:39:35 +08:00
parent 75e0ba4ce3
commit 822ae2a135
1 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,7 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Selection;
import javax.persistence.metamodel.Metamodel;
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import java.io.IOException;
@ -1134,7 +1135,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 );