java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.jooq.exception.DataAccessException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ConfigurationException
,DataChangedException
,DataDefinitionException
,DataException
,DataMigrationException
,DataTypeException
,DetachedException
,IntegrityConstraintViolationException
,InvalidResultException
,IOException
,LoaderConfigurationException
,MappingException
,MockFileDatabaseException
,ParserException
,TemplatingException
The
DataAccessException
is a generic RuntimeException
indicating that something went wrong while executing a SQL statement from
jOOQ.
Unlike JDBC, jOOQ throws RuntimeException
, knowing that
- most
SQLException
types are not recoverable. - even when they are (e.g.
SQLIntegrityConstraintViolationException
), they won't appear with most statements.
Apart from jOOQ's own DataAccessException
subtypes, which are thrown
by jOOQ's internals, most SQLException
types (or
R2dbcException
types) are translated and wrapped by:
DataException
when jOOQ detectsSQLStateClass.C22_DATA_EXCEPTION
.IntegrityConstraintViolationException
when jOOQ detectsSQLStateClass.C23_INTEGRITY_CONSTRAINT_VIOLATION
.DataAccessException
otherwise.
- Author:
- Sergey Epik - Merged into jOOQ from Spring JDBC Support, Lukas Eder
- See Also:
-
Constructor Summary
ConstructorDescriptionDataAccessException
(String message) Constructor for DataAccessException.DataAccessException
(String message, Throwable cause) Constructor for DataAccessException. -
Method Summary
Modifier and TypeMethodDescription<T extends Throwable>
TFind a root cause of a given type, ornull
if no root cause of that type was found.@NotNull String
sqlState()
Retrieve theSQLException.getSQLState()
orR2dbcException.getSqlState()
fromThrowable.getCause()
, if thisDataAccessException
was caused by aSQLException
orR2dbcException
.@NotNull SQLStateClass
Decode theSQLException.getSQLState()
orR2dbcException.getSqlState()
fromThrowable.getCause()
intoSQLStateClass
, if thisDataAccessException
was caused by aSQLException
orR2dbcException
.static @NotNull SQLStateClass
sqlStateClass
(io.r2dbc.spi.R2dbcException e) Decode theR2dbcException.getSqlState()
intoSQLStateClass
.static @NotNull SQLStateClass
Decode theSQLException.getSQLState()
intoSQLStateClass
.@NotNull SQLStateSubclass
Decode theSQLException.getSQLState()
orR2dbcException.getSqlState()
fromThrowable.getCause()
intoSQLStateSubclass
, if thisDataAccessException
was caused by aSQLException
orR2dbcException
.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
DataAccessException
Constructor for DataAccessException.- Parameters:
message
- the detail message
-
DataAccessException
Constructor for DataAccessException.- Parameters:
message
- the detail messagecause
- the root cause (usually from using a underlying data access API such as JDBC)
-
-
Method Details
-
sqlState
Retrieve theSQLException.getSQLState()
orR2dbcException.getSqlState()
fromThrowable.getCause()
, if thisDataAccessException
was caused by aSQLException
orR2dbcException
. -
sqlStateClass
Decode theSQLException.getSQLState()
orR2dbcException.getSqlState()
fromThrowable.getCause()
intoSQLStateClass
, if thisDataAccessException
was caused by aSQLException
orR2dbcException
. -
sqlStateClass
Decode theSQLException.getSQLState()
intoSQLStateClass
. -
sqlStateClass
Decode theR2dbcException.getSqlState()
intoSQLStateClass
. -
sqlStateSubclass
Decode theSQLException.getSQLState()
orR2dbcException.getSqlState()
fromThrowable.getCause()
intoSQLStateSubclass
, if thisDataAccessException
was caused by aSQLException
orR2dbcException
. -
getStackTrace
- Overrides:
getStackTrace
in classThrowable
-
getCause
Find a root cause of a given type, ornull
if no root cause of that type was found.
-