Class JdbcExceptionHelper
java.lang.Object
org.hibernate.jdbc.spi.JdbcExceptionHelper
Inspects a JDBC exception chain for vendor error information.
JDBC drivers sometimes report the useful error code or SQL state on a
nested exception reached through SQLException.getNextException(). These
operations return the first usable value in that JDBC exception chain.
They do not inspect the general Java cause chain.
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdetermineSqlStateClassCode(String sqlState) Returns the two-character class code of a SQL state.static intextractErrorCode(SQLException sqlException) Finds the first nonzero vendor error code in the JDBC exception chain.static StringextractSqlState(SQLException sqlException) Finds the first non-null SQL state in the JDBC exception chain.static StringextractSqlStateClassCode(SQLException sqlException) Finds the first SQL state and returns its two-character class code.
-
Method Details
-
extractErrorCode
Finds the first nonzero vendor error code in the JDBC exception chain.- Parameters:
sqlException- the first exception in the chain- Returns:
- the first nonzero error code, or zero when every error code is zero
- Since:
- 8.0
-
extractSqlState
Finds the first non-null SQL state in the JDBC exception chain.- Parameters:
sqlException- the first exception in the chain- Returns:
- the first SQL state, or
nullwhen none is available - Since:
- 8.0
-
extractSqlStateClassCode
Finds the first SQL state and returns its two-character class code.- Parameters:
sqlException- the first exception in the chain- Returns:
- the SQL-state class code, or
nullwhen no state is available - Since:
- 8.0
-
determineSqlStateClassCode
Returns the two-character class code of a SQL state.
A null or shorter value is returned unchanged.
- Parameters:
sqlState- a SQL state, ornull- Returns:
- its class code, or the unchanged null or short value
- Since:
- 8.0
-