Package org.hibernate.exception.internal
Class SQLStateConversionDelegate
- java.lang.Object
-
- org.hibernate.exception.spi.AbstractSQLExceptionConversionDelegate
-
- org.hibernate.exception.internal.SQLStateConversionDelegate
-
- All Implemented Interfaces:
SQLExceptionConversionDelegate
public class SQLStateConversionDelegate extends AbstractSQLExceptionConversionDelegate
ASQLExceptionConverter
implementation which performs conversion 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).SQLState codes are defined by both ANSI SQL specs and X/Open. Some "classes" are shared, others are specific to one or another, yet others are custom vendor classes. Unfortunately I have not been able to find a "blessed" list of X/Open codes. These codes are cobbled together between ANSI SQL spec and error code tables from few vendor's documentation.
-
-
Constructor Summary
Constructors Constructor Description SQLStateConversionDelegate(ConversionContext conversionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable JDBCException
convert(SQLException sqlException, String message, String sql)
Convert the givenSQLException
to a subtype ofJDBCException
, if possible.-
Methods inherited from class org.hibernate.exception.spi.AbstractSQLExceptionConversionDelegate
getConversionContext
-
-
-
-
Constructor Detail
-
SQLStateConversionDelegate
public SQLStateConversionDelegate(ConversionContext conversionContext)
-
-
Method Detail
-
convert
public @Nullable JDBCException convert(SQLException sqlException, String message, String sql)
Description copied from interface:SQLExceptionConversionDelegate
Convert the givenSQLException
to a subtype ofJDBCException
, if possible.- Parameters:
sqlException
- TheSQLException
to be convertedmessage
- An optional error messagesql
- The SQL statement that resulted in the exception- Returns:
- The resulting
JDBCException
, ornull
if this delegate does not know how to interpret the givenSQLException
.
-
-