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