Filed a JIRA for this issue : https://issues.apache.org/jira/browse/OPENJPA-458
Gul -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, December 02, 2007 6:16 PM To: [email protected] Subject: Re: EntityExistsException Hi Gul, The way I read the spec, these exceptions should be the top exception. That is, you should be able to } catch (EntityExistsException eeex) { and not have to catch Throwable and dive into the exception. If this is not the behavior you see, please raise a JIRA and attach a simple test case. And if you're so inclined, provide a patch for the issue. Thanks, Craig On Dec 2, 2007, at 8:32 AM, Gul Onural wrote: > > 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. Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
