diff --git a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java index 879a2cce13..9d2962bc14 100755 --- a/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java +++ b/hibernate-entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java @@ -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 );