JPA Exception

OptimisticLockException

java.lang.Object
  ∟ java.lang.Throwable
    ∟ java.lang.Exception
      ∟ java.lang.RuntimeException
        ∟ javax.persistence.PersistenceException
          ∟ javax.persistence.OptimisticLockException

Thrown by the persistence provider when an optimistic locking conflict occurs. This exception may be thrown as part of an API call, a flush or at commit time. The current transaction, if one is active, will be marked for rollback.
See Also:
EntityManager.find
EntityManager.find
EntityManager.lock
EntityManager.lock
Since:
JPA 1.0

Public Constructors

Constructs a new OptimisticLockException exception with null as its detail message.
Since:
JPA 1.0
OptimisticLockException(Object entity)
Constructs a new OptimisticLockException exception with the specified entity.
Parameters:
entity the - entity.
Since:
JPA 1.0
OptimisticLockException(String message)
Constructs a new OptimisticLockException exception with the specified detail message.
Parameters:
message the - detail message.
Since:
JPA 1.0
OptimisticLockException(String message, Throwable cause)
Constructs a new OptimisticLockException exception with the specified detail message and cause.
Parameters:
message the - detail message.
cause the - cause.
Since:
JPA 1.0
OptimisticLockException(String message, Throwable cause, Object entity)
Constructs a new OptimisticLockException exception with the specified detail message, cause, and entity.
Parameters:
message the - detail message.
cause the - cause.
entity the - entity.
Since:
JPA 1.0
OptimisticLockException(Throwable cause)
Constructs a new OptimisticLockException exception with the specified cause.
Parameters:
cause the - cause.
Since:
JPA 1.0

Public Methods

Object getEntity()
Returns the entity that caused this exception.
Return:
the entity.
Since:
JPA 1.0

Method inherited from class java.lang.Throwable

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

Method inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait