Top Description Fields Constructors Methods
org.hibernate

public Class JDBCException

extends HibernateException
Class Inheritance
Known Direct Subclasses
org.hibernate.PessimisticLockException, org.hibernate.QueryTimeoutException, org.hibernate.exception.ConstraintViolationException, org.hibernate.exception.DataException, org.hibernate.exception.GenericJDBCException, org.hibernate.exception.JDBCConnectionException, org.hibernate.exception.LockAcquisitionException, org.hibernate.exception.SQLGrammarException
Imports
java.sql.SQLException

Wraps a SQLException. Indicates that an exception occurred during a JDBC call.
Author
Gavin King
See Also
java.sql.SQLException

Field Summary

Modifier and TypeField and Description
private final String
private final SQLException

Constructor Summary

AccessConstructor and Description
public
JDBCException(String
The message explaining the exception condition
message
,
SQLException
The underlying cause
cause
)

Constructs a JDBCException using the given information.

public
JDBCException(String
The message explaining the exception condition
message
,
SQLException
The underlying cause
cause
,
String
The sql being executed when the exception occurred
sql
)

Constructs a JDBCException using the given information.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The vendor specific error code
getErrorCode
()

Get the vendor specific error code from the underlying SQLException.

public String

Returns:

The SQL statement; may return null.
getSQL
()

Get the actual SQL statement being executed when the exception occurred.

public SQLException

Returns:

The SQLException
getSQLException
()

Get the underlying SQLException.

public String

Returns:

The X/Open or ANSI SQL SQLState error code; may return null.
getSQLState
()

Get the X/Open or ANSI SQL SQLState error code from the underlying SQLException.

Field Detail

sqlback to summary
private final String sql
sqlExceptionback to summary
private final SQLException sqlException

Constructor Detail

JDBCExceptionback to summary
public JDBCException(String message, SQLException cause)

Constructs a JDBCException using the given information.

Parameters
message:String

The message explaining the exception condition

cause:SQLException

The underlying cause

JDBCExceptionback to summary
public JDBCException(String message, SQLException cause, String sql)

Constructs a JDBCException using the given information.

Parameters
message:String

The message explaining the exception condition

cause:SQLException

The underlying cause

sql:String

The sql being executed when the exception occurred

Method Detail

getErrorCodeback to summary
public int getErrorCode()

Get the vendor specific error code from the underlying SQLException.

Returns:int

The vendor specific error code

See Also
java.sql.SQLException#getErrorCode()
getSQLback to summary
public String getSQL()

Get the actual SQL statement being executed when the exception occurred.

Returns:String

The SQL statement; may return null.

getSQLExceptionback to summary
public SQLException getSQLException()

Get the underlying SQLException.

Returns:SQLException

The SQLException

getSQLStateback to summary
public String getSQLState()

Get the X/Open or ANSI SQL SQLState error code from the underlying SQLException.

Returns:String

The X/Open or ANSI SQL SQLState error code; may return null.

See Also
java.sql.SQLException#getSQLState()