KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > exception > SQLExceptionConverter


1 // $Id: SQLExceptionConverter.java,v 1.3 2004/11/21 00:11:27 pgmjsd Exp $
2
package org.hibernate.exception;
3
4 import org.hibernate.JDBCException;
5
6 import java.sql.SQLException JavaDoc;
7
8 /**
9  * Defines a contract for implementations that know how to convert a SQLException
10  * into Hibernate's JDBCException hierarchy. Inspired by Spring's
11  * SQLExceptionTranslator.
12  * <p/>
13  * Implementations <b>must</b> have a constructor which takes a
14  * {@link ViolatedConstraintNameExtracter} parameter.
15  * <p/>
16  * Implementations may implement {@link Configurable} if they need to perform
17  * configuration steps prior to first use.
18  *
19  * @author Steve Ebersole
20  * @see SQLExceptionConverterFactory
21  */

22 public interface SQLExceptionConverter {
23     /**
24      * Convert the given SQLException into Hibernate's JDBCException hierarchy.
25      *
26      * @param sqlException The SQLException to be converted.
27      * @param message An optional error message.
28      * @return The resulting JDBCException.
29      * @see ConstraintViolationException, JDBCConnectionException, SQLGrammarException, LockAcquisitionException
30      */

31     public JDBCException convert(SQLException JavaDoc sqlException, String JavaDoc message, String JavaDoc sql);
32 }
33
Popular Tags