HHH-8341 JtaTransaction logs excessive HHH000426 warning

This commit is contained in:
Brett Meyer 2013-11-25 13:35:25 -05:00
parent 1566586fbf
commit f24e470181
4 changed files with 18 additions and 16 deletions

View File

@ -151,8 +151,8 @@ import org.jboss.logging.Logger;
* Session</tt> (de)serialization.</td> * Session</tt> (de)serialization.</td>
* </tr> * </tr>
* <tr> * <tr>
* <td><tt>hibernate.transaction.manager_lookup_class</tt></td> * <td><tt>hibernate.transaction.jta.platform</tt></td>
* <td>classname of <tt>org.hibernate.transaction.TransactionManagerLookup</tt> * <td>classname of <tt>org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform</tt>
* implementor</td> * implementor</td>
* </tr> * </tr>
* <tr> * <tr>

View File

@ -156,9 +156,6 @@ public class JtaTransaction extends AbstractTransactionImpl {
catch ( Exception e ) { catch ( Exception e ) {
throw new TransactionException( "JTA commit failed: ", e ); throw new TransactionException( "JTA commit failed: ", e );
} }
finally {
isInitiator = false;
}
} }
@Override @Override
@ -169,17 +166,22 @@ public class JtaTransaction extends AbstractTransactionImpl {
@Override @Override
protected void afterAfterCompletion() { protected void afterAfterCompletion() {
// this method is a noop if there is a Synchronization! // this method is a noop if there is a Synchronization!
if ( isDriver ) { try {
if ( !isInitiator ) { if ( isDriver ) {
LOG.setManagerLookupClass(); if ( !isInitiator ) {
} LOG.setManagerLookupClass();
try { }
transactionCoordinator().afterTransaction( this, userTransaction.getStatus() ); try {
} transactionCoordinator().afterTransaction( this, userTransaction.getStatus() );
catch (SystemException e) { }
throw new TransactionException( "Unable to determine UserTransaction status", e ); catch (SystemException e) {
throw new TransactionException( "Unable to determine UserTransaction status", e );
}
} }
} }
finally {
isInitiator = false;
}
} }
@Override @Override

View File

@ -1501,7 +1501,7 @@ public interface CoreMessageLogger extends BasicLogger {
void unableToCloseSessionButSwallowingError(HibernateException e); void unableToCloseSessionButSwallowingError(HibernateException e);
@LogMessage(level = WARN) @LogMessage(level = WARN)
@Message(value = "You should set hibernate.transaction.manager_lookup_class if cache is enabled", id = 426) @Message(value = "You should set hibernate.transaction.jta.platform if cache is enabled", id = 426)
void setManagerLookupClass(); void setManagerLookupClass();
// @LogMessage(level = WARN) // @LogMessage(level = WARN)

View File

@ -1536,7 +1536,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
TransactionManager transactionManager = sfi().getServiceRegistry().getService( JtaPlatform.class ).retrieveTransactionManager(); TransactionManager transactionManager = sfi().getServiceRegistry().getService( JtaPlatform.class ).retrieveTransactionManager();
if ( transactionManager == null ) { if ( transactionManager == null ) {
throw new PersistenceException( throw new PersistenceException(
"Using a JTA persistence context wo setting hibernate.transaction.manager_lookup_class" "Using a JTA persistence context wo setting hibernate.transaction.jta.platform"
); );
} }
try { try {