openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: How do I distinguish different types of exceptions in openjpa
Date Sun, 02 Dec 2007 23:19:39 GMT
Hi Gul,

If you execute a JPA method, the JPA exception thrown should be able  
to be caught directly.

But if you're using a framework API for example to complete  
transactions via UserTransaction, then the exception is not directly  
a JPA exception but a framework exception.

To get a JPA exception for these cases, you can try flush() which  
will stimulate OpenJPA to try to flush the changes, leaving only the  
commit itself for the framework. And if flush succeeds, and commit  
fails, then you have a framework issue not an OpenJPA issue.

Craig

On Nov 29, 2007, at 8:47 AM, Gul Onural wrote:

>
> When a database error occurs in the openjpa, I always get rollback
> exception. For example if there is an error
> because of a duplicate record creation attempt, I still get rollback
> exception.
>
> Is there a way to inspect the exception to see the root cause ?
>
> Gul

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message