|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.engine.jdbc.spi.SqlExceptionHelper
public class SqlExceptionHelper
Helper for handling SQLExceptions in various manners.
| Nested Class Summary | |
|---|---|
static class |
SqlExceptionHelper.StandardWarningHandler
|
static interface |
SqlExceptionHelper.WarningHandler
Contract for handling warnings |
static class |
SqlExceptionHelper.WarningHandlerLoggingSupport
Basic support for SqlExceptionHelper.WarningHandler implementations which log |
| Field Summary | |
|---|---|
static SQLExceptionConverter |
DEFAULT_CONVERTER
|
static String |
DEFAULT_EXCEPTION_MSG
|
static String |
DEFAULT_WARNING_MSG
|
static SqlExceptionHelper.StandardWarningHandler |
STANDARD_WARNING_HANDLER
|
| Constructor Summary | |
|---|---|
SqlExceptionHelper()
Create an exception helper with a default exception converter. |
|
SqlExceptionHelper(SQLExceptionConverter sqlExceptionConverter)
Create an exception helper with a specific exception converter. |
|
| Method Summary | |
|---|---|
JDBCException |
convert(SQLException sqlException,
String message)
Convert an SQLException using the current converter, doing some logging first. |
JDBCException |
convert(SQLException sqlException,
String message,
String sql)
Convert an SQLException using the current converter, doing some logging first. |
SQLExceptionConverter |
getSqlExceptionConverter()
Access the current exception converter being used internally. |
void |
handleAndClearWarnings(Connection connection,
SqlExceptionHelper.WarningHandler handler)
General purpose handling of warnings associated with a JDBC Connection. |
void |
handleAndClearWarnings(Statement statement,
SqlExceptionHelper.WarningHandler handler)
General purpose handling of warnings associated with a JDBC Statement. |
void |
logAndClearWarnings(Connection connection)
Standard (legacy) behavior for logging warnings associated with a JDBC Connection and clearing them. |
void |
logExceptions(SQLException sqlException,
String message)
Log the given (and any nested) exception. |
void |
setSqlExceptionConverter(SQLExceptionConverter sqlExceptionConverter)
Inject the exception converter to use. |
void |
walkWarnings(SQLWarning warning,
SqlExceptionHelper.WarningHandler handler)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_EXCEPTION_MSG
public static final String DEFAULT_WARNING_MSG
public static final SQLExceptionConverter DEFAULT_CONVERTER
public static SqlExceptionHelper.StandardWarningHandler STANDARD_WARNING_HANDLER
| Constructor Detail |
|---|
public SqlExceptionHelper()
public SqlExceptionHelper(SQLExceptionConverter sqlExceptionConverter)
sqlExceptionConverter - The exception converter to use.| Method Detail |
|---|
public SQLExceptionConverter getSqlExceptionConverter()
public void setSqlExceptionConverter(SQLExceptionConverter sqlExceptionConverter)
sqlExceptionConverter - The converter to use.
public JDBCException convert(SQLException sqlException,
String message)
sqlException - The exception to convertmessage - An error message.
public JDBCException convert(SQLException sqlException,
String message,
String sql)
sqlException - The exception to convertmessage - An error message.sql - The SQL being executed when the exception occurred
public void logExceptions(SQLException sqlException,
String message)
sqlException - The exception to logmessage - The message text to use as a preamble.
public void walkWarnings(SQLWarning warning,
SqlExceptionHelper.WarningHandler handler)
public void logAndClearWarnings(Connection connection)
Connection and clearing them.
Calls handleAndClearWarnings(Connection, WarningHandler) using STANDARD_WARNING_HANDLER
connection - The JDBC connection potentially containing warnings
public void handleAndClearWarnings(Connection connection,
SqlExceptionHelper.WarningHandler handler)
Connection.
connection - The JDBC connection potentially containing warningshandler - The handler for each individual warning in the stack.walkWarnings(java.sql.SQLWarning, org.hibernate.engine.jdbc.spi.SqlExceptionHelper.WarningHandler)
public void handleAndClearWarnings(Statement statement,
SqlExceptionHelper.WarningHandler handler)
Statement.
statement - The JDBC statement potentially containing warningshandler - The handler for each individual warning in the stack.walkWarnings(java.sql.SQLWarning, org.hibernate.engine.jdbc.spi.SqlExceptionHelper.WarningHandler)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||