Package org.hibernate
Class JDBCException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ConstraintViolationException,DataException,GenericJDBCException,JDBCConnectionException,LockAcquisitionException,PessimisticLockException,QueryTimeoutException,SQLGrammarException
Wraps a
SQLException arising from the JDBC driver.
Indicates that an error occurred during a JDBC call.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJDBCException(String message, SQLException cause) Constructs aJDBCExceptionusing the given information.JDBCException(String message, SQLException cause, String sql) Constructs aJDBCExceptionusing the given information. -
Method Summary
Modifier and TypeMethodDescriptionintGet the vendor specific error code from the underlyingSQLException.getSQL()Get the actual SQL statement being executed when the exception occurred.Get the underlyingSQLException.Get the X/Open or ANSI SQL SQLState error code from the underlyingSQLException.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JDBCException
Constructs aJDBCExceptionusing the given information.- Parameters:
message- The message explaining the exception conditioncause- The underlying cause
-
JDBCException
Constructs aJDBCExceptionusing the given information.- Parameters:
message- The message explaining the exception conditioncause- The underlying causesql- The sql being executed when the exception occurred
-
-
Method Details
-
getSQLState
Get the X/Open or ANSI SQL SQLState error code from the underlyingSQLException.- Returns:
- The X/Open or ANSI SQL SQLState error code; may return null.
- See Also:
-
getErrorCode
public int getErrorCode()Get the vendor specific error code from the underlyingSQLException.- Returns:
- The vendor specific error code
- See Also:
-
getSQLException
Get the underlyingSQLException.- Returns:
- The SQLException
-
getSQL
Get the actual SQL statement being executed when the exception occurred.- Returns:
- The SQL statement; may return null.
-
getErrorMessage
- Returns:
- The error message without the SQL statement appended
-