Package org.springframework.dao

# Class DataAccessException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.dao.DataAccessException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `NonTransientDataAccessException`, `RecoverableDataAccessException`, `TransientDataAccessException`

public abstract class DataAccessException extends org.springframework.core.NestedRuntimeException
Root of the hierarchy of data access exceptions discussed in Expert One-On-One J2EE Design and Development. Please see Chapter 9 of this book for detailed discussion of the motivation for this package.

This exception hierarchy aims to let user code find and handle the kind of error encountered without knowing the details of the particular data access API in use (for example, JDBC). Thus, it is possible to react to an optimistic locking failure without knowing that JDBC is being used.

As this class is a runtime exception, there is no need for user code to catch it or subclasses if any error is to be considered fatal (the usual case).

Author:
  Rod Johnson
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`DataAccessException(String msg)`
Constructor for DataAccessException.
`DataAccessException(String msg, Throwable cause)`
Constructor for DataAccessException.

## Method Summary

### Methods inherited from class org.springframework.core.NestedRuntimeException

`contains, getMostSpecificCause, getRootCause`

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DataAccessException

public DataAccessException(@Nullable String msg)
Constructor for DataAccessException.

Parameters:
  `msg` - the detail message

### DataAccessException

public DataAccessException(@Nullable String msg, @Nullable Throwable cause)
Constructor for DataAccessException.

Parameters:
  `msg` - the detail message
  `cause` - the root cause (usually from using an underlying data access API such as JDBC)