Package org.hibernate
Class JDBCException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- javax.persistence.PersistenceException
-
- org.hibernate.HibernateException
-
- org.hibernate.JDBCException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ConstraintViolationException
,DataException
,GenericJDBCException
,JDBCConnectionException
,LockAcquisitionException
,PessimisticLockException
,QueryTimeoutException
,SQLGrammarException
public class JDBCException extends HibernateException
Wraps aSQLException
. Indicates that an exception occurred during a JDBC call.- See Also:
SQLException
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JDBCException(java.lang.String message, java.sql.SQLException cause)
Constructs a JDBCException using the given information.JDBCException(java.lang.String message, java.sql.SQLException cause, java.lang.String sql)
Constructs a JDBCException using the given information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getErrorCode()
Get the vendor specific error code from the underlyingSQLException
.java.lang.String
getSQL()
Get the actual SQL statement being executed when the exception occurred.java.sql.SQLException
getSQLException()
Get the underlyingSQLException
.java.lang.String
getSQLState()
Get the X/Open or ANSI SQL SQLState error code from the underlyingSQLException
.
-
-
-
Constructor Detail
-
JDBCException
public JDBCException(java.lang.String message, java.sql.SQLException cause)
Constructs a JDBCException using the given information.- Parameters:
message
- The message explaining the exception conditioncause
- The underlying cause
-
JDBCException
public JDBCException(java.lang.String message, java.sql.SQLException cause, java.lang.String sql)
Constructs a JDBCException using the given information.- Parameters:
message
- The message explaining the exception conditioncause
- The underlying causesql
- The sql being executed when the exception occurred
-
-
Method Detail
-
getSQLState
public java.lang.String 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:
SQLException.getSQLState()
-
getErrorCode
public int getErrorCode()
Get the vendor specific error code from the underlyingSQLException
.- Returns:
- The vendor specific error code
- See Also:
SQLException.getErrorCode()
-
getSQLException
public java.sql.SQLException getSQLException()
Get the underlyingSQLException
.- Returns:
- The SQLException
-
getSQL
public java.lang.String getSQL()
Get the actual SQL statement being executed when the exception occurred.- Returns:
- The SQL statement; may return null.
-
-