HHH-8442 certain EntityManager operations (createQuery()) should rollback the TX for when Runtime exceptions are thrown

This commit is contained in:
Scott Marlow 2013-09-11 12:22:55 -04:00
parent 4027f131e3
commit bcb84dd49b
1 changed files with 7 additions and 1 deletions

View File

@ -730,7 +730,12 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
@Override
public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery) {
checkOpen();
return (TypedQuery<T>) criteriaCompiler().compile( (CompilableCriteria) criteriaQuery );
try {
return (TypedQuery<T>) criteriaCompiler().compile( (CompilableCriteria) criteriaQuery );
}
catch ( RuntimeException e ) {
throw convert( e );
}
}
@Override
@ -1280,6 +1285,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
@Override
public CriteriaBuilder getCriteriaBuilder() {
checkOpen();
return getEntityManagerFactory().getCriteriaBuilder();
}