Hi all,

I'm trying to create web services using xfire + spring + hibernate.
I'd like to get error codes of MySQL when the database work exceptionally.
I create a exception class that extends FaultInfoException and I have a sql
error codes trasnlator class that extends
SQLErrorCodeSQLExceptionTranslator.
But I don't know how connect these two classes and I don't have a better
idea.
Please help!

public class BookServiceImpl implements BookService {
        private BookDao bookDao;
        
        public Book getBook(int id) {
                // Do I throw the BookException? But how do I get the error 
code?
                return bookDao;
        }
}

public class BookException extends FaultInfoException {

        private BookExceptionDetail faultDetail;

        public BookException(String msg,BookExceptionDetail details){
                super(msg);
                faultDetail=details;
        }
        public BookExceptionDetail getFaultInfo() {
                return faultDetail;
        }

        public static QName getFaultName() {
                return new QName("http://sample.net";, "BookFault");
        }
}

public class MySQLErrorCodesTranslator extends
SQLErrorCodeSQLExceptionTranslator {
        protected DataAccessException customTranslate(String task, String sql,
SQLException sqlex) {
                int errorCode = sqlex.getErrorCode();   // I can get a error 
code here.
                // but what to do after this?
        }
}

Regards,
R.A
-- 
View this message in context: 
http://www.nabble.com/How-do-I-get--error-code--tf3446648.html#a9611854
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