java.lang.Object
java.lang.Throwable
java.lang.Exception
java.sql.SQLException
com.aoapps.sql.WrappedSQLException
- All Implemented Interfaces:
Serializable,Iterable<Throwable>
Deprecated.
Wraps a
SQLException to include its source SQL statement.- Author:
- AO Industries, Inc.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionWrappedSQLException(String reason, String sqlState, int vendorCode, Throwable cause, String sqlString) Deprecated.Please useErrorPrinter.addSql(java.lang.Throwable, java.lang.String)instead of wrapping exceptions.WrappedSQLException(SQLException cause, String sqlString) Deprecated.Please useErrorPrinter.addSql(java.lang.Throwable, java.lang.String)instead of wrapping exceptions.WrappedSQLException(SQLException cause, PreparedStatement pstmt) Deprecated.Please useErrorPrinter.addSql(java.lang.Throwable, java.sql.PreparedStatement)instead of wrapping exceptions. -
Method Summary
Methods inherited from class java.sql.SQLException
getErrorCode, getNextException, getSQLState, iterator, setNextExceptionMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
WrappedSQLException
Deprecated.Please useErrorPrinter.addSql(java.lang.Throwable, java.sql.PreparedStatement)instead of wrapping exceptions. -
WrappedSQLException
Deprecated.Please useErrorPrinter.addSql(java.lang.Throwable, java.lang.String)instead of wrapping exceptions. -
WrappedSQLException
@Deprecated public WrappedSQLException(String reason, String sqlState, int vendorCode, Throwable cause, String sqlString) Deprecated.Please useErrorPrinter.addSql(java.lang.Throwable, java.lang.String)instead of wrapping exceptions.
-
-
Method Details
-
getSqlString
Deprecated.
-

SQLExceptionto represent different conditions, such as when no row is returned. This allows the simple use of standard catch blocks to handle different conditions accordingly. However, wrapping the original exception defeats this, as it just become a genericSQLException, albeit with SQL STATE and such copied from the original exception.The primary purpose of wrapping exceptions was to attach the SQL statement being processed at the time of failure. This statement is only used in error reporting, specifically via
ErrorPrinter. We have created a new way to accomplish this, without altering or wrapping any exceptions: register an exception and corresponding SQL statement directly withErrorPrinter, which will then automatically be included in error reports.