HHH-6697 Fixed conversion of Hibernate exceptions to JPA exceptions.

This commit is contained in:
Michael Rudolf 2011-09-29 21:33:16 +02:00 committed by Strong Liu
parent 3bd95da6c5
commit e69b37a9a4
1 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,7 @@ package org.hibernate.ejb;
import javax.persistence.CacheRetrieveMode;
import javax.persistence.CacheStoreMode;
import javax.persistence.EntityExistsException;
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.EntityTransaction;
@ -1354,6 +1355,11 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
handlePersistenceException( converted );
return converted;
}
else if ( e instanceof org.hibernate.NonUniqueObjectException ) {
EntityExistsException converted = new EntityExistsException( e.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( e instanceof org.hibernate.NonUniqueResultException ) {
NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
handlePersistenceException( converted );