org.hibernate.exception.internal
Class SQLStateConversionDelegate

java.lang.Object
  extended by org.hibernate.exception.spi.AbstractSQLExceptionConversionDelegate
      extended by org.hibernate.exception.internal.SQLStateConversionDelegate
All Implemented Interfaces:
SQLExceptionConversionDelegate

public class SQLStateConversionDelegate
extends AbstractSQLExceptionConversionDelegate

A SQLExceptionConverter implementation which performs conversion based on the underlying SQLState. Interpretation of a SQL error based on SQLState is not nearly as accurate as using the ErrorCode (which is, however, vendor-specific). SQLState codes are defined by both ANSI SQL specs and X/Open. Some of the "classes" are shared, others are specific to one or another, yet others are custom vendor classes. Unfortunately I have not been able to find a "blessed" list of X/Open codes. These codes are cobbled together between ANSI SQL spec and error code tables from few vendors documentation.


Constructor Summary
SQLStateConversionDelegate(ConversionContext conversionContext)
           
 
Method Summary
 JDBCException convert(SQLException sqlException, String message, String sql)
          Convert the given SQLException into the Hibernate JDBCException hierarchy.
 
Methods inherited from class org.hibernate.exception.spi.AbstractSQLExceptionConversionDelegate
getConversionContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLStateConversionDelegate

public SQLStateConversionDelegate(ConversionContext conversionContext)
Method Detail

convert

public JDBCException convert(SQLException sqlException,
                             String message,
                             String sql)
Description copied from interface: SQLExceptionConversionDelegate
Convert the given SQLException into the Hibernate JDBCException hierarchy.

Parameters:
sqlException - The SQLException to be converted.
message - An (optional) error message.
sql - The SQL statement, if one, being performed when the exception occurred.
Returns:
The resulting JDBCException, can be null


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.