HHH-12472 - WildFly (IronJacamar) - EntityManager#find with roll-back-only leads to exception rather than return null

This commit is contained in:
Steve Ebersole 2018-05-14 07:52:15 -05:00
parent f8ffbd03ff
commit 1570c71833
1 changed files with 10 additions and 0 deletions

View File

@ -52,6 +52,7 @@ import org.hibernate.Filter;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.IdentifierLoadAccess; import org.hibernate.IdentifierLoadAccess;
import org.hibernate.JDBCException;
import org.hibernate.LobHelper; import org.hibernate.LobHelper;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.LockOptions; import org.hibernate.LockOptions;
@ -3494,6 +3495,15 @@ public final class SessionImpl
catch ( MappingException | TypeMismatchException | ClassCastException e ) { catch ( MappingException | TypeMismatchException | ClassCastException e ) {
throw exceptionConverter.convert( new IllegalArgumentException( e.getMessage(), e ) ); throw exceptionConverter.convert( new IllegalArgumentException( e.getMessage(), e ) );
} }
catch ( JDBCException e ) {
if ( accessTransaction().getRollbackOnly() ) {
// assume this is the similar to the WildFly / IronJacamar "feature" described under HHH-12472
return null;
}
else {
throw exceptionConverter.convert( e, lockOptions );
}
}
catch ( RuntimeException e ) { catch ( RuntimeException e ) {
throw exceptionConverter.convert( e, lockOptions ); throw exceptionConverter.convert( e, lockOptions );
} }