JPA Exceptions
JPA exceptions are represented by a hierarchy of unchecked exceptions:
java.lang.Objectjava.lang.Throwablejava.lang.Exceptionjava.lang.RuntimeExceptionjavax.persistence.PersistenceExceptionjavax.persistence.EntityExistsExceptionjavax.persistence.EntityNotFoundExceptionjavax.persistence.LockTimeoutExceptionjavax.persistence.NonUniqueResultExceptionjavax.persistence.NoResultExceptionjavax.persistence.OptimisticLockExceptionjavax.persistence.PessimisticLockExceptionjavax.persistence.QueryTimeoutExceptionjavax.persistence.RollbackExceptionjavax.persistence.TransactionRequiredException
Exception Class Overview
The root of the JPA exception class subtree is:
General errors are represented directly by the PersistenceException class. Some specific errors are represented by subclasses of PersistenceException. For example, an attempt to update the database with no active transaction is represented by: 
Database update failures that require transaction rollback are represented by:
The RollbackException exception usually wraps the real failure cause as a nested exception  (which can be obtained by the getCause method) . For example, if a transaction fails because of an attempt to store a new entity object with a primary key that is already in use by another existing entity object, the nested exception is: 
Other common causes for RollbackException are lock failures: 
Exceptions can also be thrown on an attempt to retrieve entity objects from the database. For example, when a required entity object is not found:
or during query execution:
The lock exceptions (above) may also be thrown during retrieval, if database lock has been requested for retrieved entity objects and it cannot be granted.