Enum DataAccessException.Reason

    • Enum Constant Detail

      • NonTransientDataAccess

        public static final DataAccessException.Reason NonTransientDataAccess
        Root of the hierarchy of data access exceptions that are considered non-transient - where a retry of the same operation would fail unless the cause of the Exception is corrected.
      • DataIntegrityViolation

        public static final DataAccessException.Reason DataIntegrityViolation
        Exception thrown when an attempt to insert or update data results in violation of an integrity constraint. Note that this is not purely a relational concept; unique primary keys are required by most database types.
      • DuplicateKey

        public static final DataAccessException.Reason DuplicateKey
        Exception thrown when an attempt to insert or update data results in violation of a primary key or unique constraint. Note that this is not necessarily a purely relational concept; unique primary keys are required by most database types.
      • InvalidDataAccessResourceUsage

        public static final DataAccessException.Reason InvalidDataAccessResourceUsage
        Root for exceptions thrown when we use a data access resource incorrectly. Thrown for example on specifying bad SQL when using a RDBMS. Resource-specific subclasses are supplied by concrete data access packages.
      • BadSqlGrammar

        public static final DataAccessException.Reason BadSqlGrammar
        Exception thrown when SQL specified is invalid. Such exceptions always have a java.sql.SQLException root cause.

        It would be possible to have subclasses for no such table, no such column etc. A custom SQLExceptionTranslator could create such more specific exceptions, without affecting code using this class.

      • InvalidResultSetAccess

        public static final DataAccessException.Reason InvalidResultSetAccess
        Exception thrown when a ResultSet has been accessed in an invalid fashion. Such exceptions always have a java.sql.SQLException root cause.

        This typically happens when an invalid ResultSet column index or name has been specified. Also thrown by disconnected SqlRowSets.

      • NonTransientDataAccessResource

        public static final DataAccessException.Reason NonTransientDataAccessResource
        Data access exception thrown when a resource fails completely and the failure is permanent.
      • DataAccessResourceFailure

        public static final DataAccessException.Reason DataAccessResourceFailure
        Data access exception thrown when a resource fails completely: for example, if we can't connect to a database using JDBC.
      • PermissionDeniedDataAccess

        public static final DataAccessException.Reason PermissionDeniedDataAccess
        Exception thrown when the underlying resource denied a permission to access a specific element, such as a specific database table.
      • UncategorizedDataAccess

        public static final DataAccessException.Reason UncategorizedDataAccess
        Normal superclass when we can't distinguish anything more specific than "something went wrong with the underlying resource": for example, a SQLException from JDBC we cannot pinpoint more precisely.
      • UncategorizedSql

        public static final DataAccessException.Reason UncategorizedSql
        Exception thrown when we can't classify a SQLException into one of our generic data access exceptions.
      • TransientDataAcces

        public static final DataAccessException.Reason TransientDataAcces
        Root of the hierarchy of data access exceptions that are considered transient - where a previously failed operation might be able to succeed when the operation is retried without any intervention by application-level functionality.
      • ConcurrencyFailure

        public static final DataAccessException.Reason ConcurrencyFailure
        Indicate the type of failure: optimistic locking, failure to acquire lock, etc.
      • PessimisticLockingFailure

        public static final DataAccessException.Reason PessimisticLockingFailure
        Exception thrown on a pessimistic locking violation.
      • CannotAcquireLock

        public static final DataAccessException.Reason CannotAcquireLock
        Failure to acquire a lock during an update, for example during a "select for update" statement.
      • CannotSerializeTransaction

        public static final DataAccessException.Reason CannotSerializeTransaction
        Failure to complete a transaction in serialized mode due to update conflicts.
      • DeadlockLoserDataAccess

        public static final DataAccessException.Reason DeadlockLoserDataAccess
        Generic exception thrown when the current process was a deadlock loser, and its transaction rolled back.
      • QueryTimeout

        public static final DataAccessException.Reason QueryTimeout
        Exception to be thrown on a query timeout. This could have different causes depending on the database API in use but most likely thrown after the database interrupts or stops the processing of a query before it has completed.

        This exception can be thrown by user code trapping the native database exception or by exception translation.

      • TransientDataAccessResource

        public static final DataAccessException.Reason TransientDataAccessResource
        Exception thrown when the underlying resource denied a permission to access a specific element, such as a specific database table.
    • Method Detail

      • values

        public static DataAccessException.Reason[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DataAccessException.Reason c : DataAccessException.Reason.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DataAccessException.Reason valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null