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 exceptionsundeterministic number of levels of nested exceptions, i.e. not obvioushow 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 thisprogrammatically, how many level deep I have to go to catch standard JPAexceptions 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 anentity reference obtained by EntityManager.getReference (Class,Object) isaccessed 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 problemoccurs. RollbackException : Thrown by the persistence provider when the EntityTransaction.commit() fails.TransactionRequiredException : Thrown by the persistence provider when atransaction 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!
smime.p7s
Description: S/MIME cryptographic signature
