Package st.orm

Class TransientPersistenceException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
OptimisticLockException

public class TransientPersistenceException extends PersistenceException
Thrown when a failure stems from concurrent activity, such as a deadlock, a serialization failure or an optimistic lock conflict. Running the whole transaction again may succeed.

The database failures of this type are the ones on which the database gave up the transaction's work because another transaction conflicted with it; the dialect classifies them from the error the database reports, whether a statement reports it or the commit does, as a database that detects a serialization conflict only when the transaction commits reports it. A failure after which the outcome of the transaction is unknown, a lost connection, including one lost during the commit, is not of this type, and neither is a lock wait timeout, which some databases answer by rolling back only the statement.

Rerun the transaction, never the statement alone: the transaction the failure occurred in cannot commit the work it did. A rerun repeats every side effect of the transactional block, so an effect outside the database belongs in a commit callback.

Since:
1.16
See Also:
  • Constructor Details

    • TransientPersistenceException

      public TransientPersistenceException()
      Constructs a new TransientPersistenceException exception with null as its detail message.
    • TransientPersistenceException

      public TransientPersistenceException(String message)
      Constructs a new TransientPersistenceException exception with the specified detail message.
      Parameters:
      message - the detail message.
    • TransientPersistenceException

      public TransientPersistenceException(String message, Throwable cause)
      Constructs a new TransientPersistenceException exception with the specified detail message and cause.
      Parameters:
      message - the detail message.
      cause - the cause.
    • TransientPersistenceException

      public TransientPersistenceException(Throwable cause)
      Constructs a new TransientPersistenceException exception with the specified cause.
      Parameters:
      cause - the cause.