Class DataAccessException


public class DataAccessException extends IOException

A database operation failed: a statement the engine refused, a connection that could not be opened or was lost, a query that returned more rows than one.

Named after Spring's, and treated the same way by @Transactional: it rolls the transaction back although it is a checked exception. Spring's rule is that unchecked exceptions roll back and checked ones commit, and in Spring a failed statement rolls back because its JDBC layer throws the unchecked DataAccessException. This runtime's data methods declare IOException, so their failures are this subtype of it, and the build's rollback rule lists it beside RuntimeException and Error. A plain IOException of the application's own -- a file it could not read -- still commits, as in Spring; rollbackFor and noRollbackFor change either.

  • Constructor Details

    • DataAccessException

      public DataAccessException(String message)
    • DataAccessException

      public DataAccessException(String message, Throwable cause)