openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gul Onural" <onu...@nortel.com>
Subject EntityExistsException
Date Sun, 02 Dec 2007 16:32:05 GMT

The JPA Spec states defines five exceptions for JPA providers to raise,
see below. However, the OpenJPA buries these exceptions
undeterministic number of levels of nested exceptions, i.e. not obvious
how many times I need to catch throwable using ex.getCause().

Am I missing something ? All I am trying to find out is that if the
transaction is rolled back because of the fact that the entity already
exists
programmatically. Is there a way to deterministically find out this
programmatically, how many level deep I have to go to catch standard JPA
exceptions
In OpenJPA?

Gul


EntityExistsException : Thrown by the persistence provider when
EntityManager.persist(Object) is called and the entity already exists. 
EntityNotFoundException : Thrown by the persistence provider when an
entity reference obtained by EntityManager.getReference(Class,Object) is
accessed but the entity does not exist. 
NonUniqueResultException : Thrown by the persistence provider when
getSingleResult() is executed on a query and there is more than one
result from the query. 
NoResultException : Thrown by the persistence provider when
getSingleResult() is executed on a query and there is no result to
return. 
OptimisticLockException : Thrown by the persistence provider when an
optimistic locking conflict occurs. 
PersistenceException : Thrown by the persistence provider when a problem
occurs. 
RollbackException : Thrown by the persistence provider when the
EntityTransaction.commit() fails. 
TransactionRequiredException : Thrown by the persistence provider when a
transaction is required but is not active.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message