站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

SQLStateConverter (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.exception
Class SQLStateConverter

java.lang.Object
  extended bynet.sf.hibernate.exception.SQLStateConverter
All Implemented Interfaces:
SQLExceptionConverter

public class SQLStateConverter
extends Object
implements SQLExceptionConverter

A SQLExceptionConverter implementation which performs converion based on the underlying SQLState. Interpretation of a SQL error based on SQLState is not nearly as accurate as using the ErrorCode (which is, however, vendor- specific). Use of a ErrorCcode-based converter should be preferred approach for converting/interpreting SQLExceptions.

Author:
Steve Ebersole

Constructor Summary
SQLStateConverter(ViolatedConstraintNameExtracter extracter)
           
 
Method Summary
 JDBCException convert(SQLException sqlException, String message)
          Convert the given SQLException into Hibernate's JDBCException hierarchy.
protected  JDBCException handledNonSpecificException(SQLException sqlException, String message)
          Handle an exception not converted to a specific type based on the SQLState.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLStateConverter

public SQLStateConverter(ViolatedConstraintNameExtracter extracter)
Method Detail

convert

public JDBCException convert(SQLException sqlException,
                             String message)
Convert the given SQLException into Hibernate's JDBCException hierarchy.

Specified by:
convert in interface SQLExceptionConverter
Parameters:
sqlException - The SQLException to be converted.
message - An optional error message.
Returns:
The resulting JDBCException.
See Also:
ConstraintViolationException, JDBCConnectionException, SQLGrammarException, LockAcquisitionException

handledNonSpecificException

protected JDBCException handledNonSpecificException(SQLException sqlException,
                                                    String message)
Handle an exception not converted to a specific type based on the SQLState.

Parameters:
sqlException - The exception to be handled.
message - An optional message
Returns:
The converted exception; should never be null.