You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by SomuReddy <ch...@gmail.com> on 2008/01/14 19:47:55 UTC

How to know the error code from org.apache.openjpa.persistence.PersistenceException


Hi ,

I am getting the following exception when my database is down.. but I wanna
handle it in my code using the  error code which is "Error Code = 17,002".
but PersistenceException is not provoding any method to get that error code,
the way SQLException provide "SQLException.getErrorCode()". 

Is there anyway to know this errorcdoe in JPA???? or
Should I catch the SQLException apart from  PersistenceException ?, if I do
, will it be poossible to catch the below exception in SQLException catch
block, when it occur????


<1.0.0-SNAPSHOT-SNAPSHOT nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: Io exception: Got minus
one from a read callDSRA0010E: SQL State = null, Error Code = 17,002



-- 
View this message in context: http://www.nabble.com/How-to-know-the-error-code-from-org.apache.openjpa.persistence.PersistenceException-tp14809198p14809198.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: How to know the error code from org.apache.openjpa.persistence.PersistenceException

Posted by Pinaki Poddar <pp...@apache.org>.
PersistenceException.getNestedThrowable() will return you the underlying
exceptions.
Recurse through them till you hit the original SQLException.


-- 
View this message in context: http://www.nabble.com/How-to-know-the-error-code-from-org.apache.openjpa.persistence.PersistenceException-tp14809198p14809208.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.