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 ;7 8 /**9 * Defines a contract for implementations that know how to convert a SQLException10 * into Hibernate's JDBCException hierarchy. Inspired by Spring's11 * SQLExceptionTranslator.12 * <p/>13 * Implementations <b>must</b> have a constructor which takes a14 * {@link ViolatedConstraintNameExtracter} parameter.15 * <p/>16 * Implementations may implement {@link Configurable} if they need to perform17 * configuration steps prior to first use.18 *19 * @author Steve Ebersole20 * @see SQLExceptionConverterFactory21 */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, LockAcquisitionException30 */31 public JDBCException convert(SQLException sqlException, String message, String sql);32 }33