Skip to content

Commit

Permalink
throw EntityExistsException as required by JPA spec 3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Sep 4, 2023
1 parent 4af9e50 commit 215c35f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.hibernate.JDBCException;
import org.hibernate.LockOptions;
import org.hibernate.ObjectNotFoundException;
import org.hibernate.PersistentObjectException;
import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.TransientObjectException;
Expand Down Expand Up @@ -120,7 +121,8 @@ else if ( exception instanceof ObjectNotFoundException ) {
rollbackIfNecessary( converted );
return converted;
}
else if ( exception instanceof org.hibernate.NonUniqueObjectException ) {
else if ( exception instanceof org.hibernate.NonUniqueObjectException
|| exception instanceof PersistentObjectException) {
final EntityExistsException converted = new EntityExistsException( exception.getMessage(), exception );
rollbackIfNecessary( converted );
return converted;
Expand Down

0 comments on commit 215c35f

Please sign in to comment.