Package org.hibernate.exception
Class SQLStateConverter
java.lang.Object
org.hibernate.exception.SQLStateConverter
- All Implemented Interfaces:
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 ErrorCode-based converter should be preferred approach
for converting/interpreting SQLExceptions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(SQLException sqlException, String message, String sql) Convert the given SQLException into Hibernate's JDBCException hierarchy.protected JDBCExceptionhandledNonSpecificException(SQLException sqlException, String message, String sql) Handle an exception not converted to a specific type based on the SQLState.
-
Constructor Details
-
SQLStateConverter
-
-
Method Details
-
convert
Convert the given SQLException into Hibernate's JDBCException hierarchy.- Specified by:
convertin interfaceSQLExceptionConverter- Parameters:
sqlException- The SQLException to be converted.message- An optional error message.sql- Optionally, the sql being performed when the exception occurred.- Returns:
- The resulting JDBCException.
-
handledNonSpecificException
protected JDBCException handledNonSpecificException(SQLException sqlException, String message, String sql) Handle an exception not converted to a specific type based on the SQLState.- Parameters:
sqlException- The exception to be handled.message- An optional messagesql- Optionally, the sql being performed when the exception occurred.- Returns:
- The converted exception; should never be null.
-