Implementation of JDBCExceptionHelper.
| Method from org.hibernate.exception.JDBCExceptionHelper Detail: |
public static JDBCException convert(SQLExceptionConverter converter,
SQLException sqlException,
String message) {
return convert( converter, sqlException, message, "???" );
}
Converts the given SQLException into Hibernate's JDBCException hierarchy, as well as performing
appropriate logging. |
public static JDBCException convert(SQLExceptionConverter converter,
SQLException sqlException,
String message,
String sql) {
JDBCExceptionReporter.logExceptions( sqlException, message + " [" + sql + "]" );
return converter.convert( sqlException, message, sql );
}
Converts the given SQLException into Hibernate's JDBCException hierarchy, as well as performing
appropriate logging. |
public static String determineSqlStateClassCode(String sqlState) {
if ( sqlState == null || sqlState.length() < 2 ) {
return sqlState;
}
return sqlState.substring( 0, 2 );
}
|
public static int extractErrorCode(SQLException sqlException) {
int errorCode = sqlException.getErrorCode();
SQLException nested = sqlException.getNextException();
while ( errorCode == 0 && nested != null ) {
errorCode = nested.getErrorCode();
nested = nested.getNextException();
}
return errorCode;
}
For the given SQLException, locates the vendor-specific error code. |
public static String extractSqlState(SQLException sqlException) {
String sqlState = sqlException.getSQLState();
SQLException nested = sqlException.getNextException();
while ( sqlState == null && nested != null ) {
sqlState = nested.getSQLState();
nested = nested.getNextException();
}
return sqlState;
}
For the given SQLException, locates the X/Open-compliant SQLState. |
public static String extractSqlStateClassCode(SQLException sqlException) {
return determineSqlStateClassCode( extractSqlState( sqlException ) );
}
For the given SQLException, locates the X/Open-compliant SQLState's class code. |