Hi Andrey,

Thank you for your reply, and sorry for not writing you soon.
Using FaultInfoException, I have to throw this subclass in all service
methods.
So I think using FaultHandler and set error codes in this FaultHandler
class.

public class MyFaultHandler extends AbstractHandler {
        public void invoke(MessageContext context) throws Exception {
                Exception e = (Exception) context.getProperty("exception");
                
                // I'd like to get sqlState and errorCode by some means.
                
                XFireFault fault = (XFireFault)
context.getExchange().getFaultMessage().getBody();
                fault.setMessage("SQL state=" + sqlState + ", error code=" + 
errorCode);
        }
}

For example, duplication entry exception occur, I get these stack trace.

2007-03-27 16:05:34,296 WARN [org.hibernate.util.JDBCExceptionReporter] -
SQL Error: 1062, SQLState: 23000
2007-03-27 16:05:34,296 ERROR [org.hibernate.util.JDBCExceptionReporter] -
Duplicate entry '15' for key 1
2007-03-27 16:05:34,296 ERROR
[org.hibernate.event.def.AbstractFlushingEventListener] - Could not
synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC
batch update
        at
org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:74)
        at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)

I'd like to get "SQL Error: 1062, SQLState: 23000" in MyFaultHandler class,
JDBCExceptionReporter output that.
Do you have any idea?

Regards,
R.A
-- 
View this message in context: 
http://www.nabble.com/How-do-I-get--error-code--tf3446648.html#a9687516
Sent from the XFire - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to