Top Description Fields Constructors Methods
jakarta.persistence

public Class OptimisticLockException

extends PersistenceException
Class Inheritance

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.
Since
1.0
See Also
EntityManager#find(Class, Object, LockModeType), EntityManager#find(Class, Object, LockModeType, java.util.Map), EntityManager#lock(Object, LockModeType), EntityManager#lock(Object, LockModeType, java.util.Map)

Field Summary

Modifier and TypeField and Description
pack-priv Object
entity

The object that caused the exception

Constructor Summary

AccessConstructor and Description
public
OptimisticLockException()

Constructs a new OptimisticLockException exception with null as its detail message.

public
OptimisticLockException(String
the detail message.
message
)

Constructs a new OptimisticLockException exception with the specified detail message.

public
OptimisticLockException(String
the detail message.
message
,
Throwable
the cause.
cause
)

Constructs a new OptimisticLockException exception with the specified detail message and cause.

public
OptimisticLockException(Throwable
the cause.
cause
)

Constructs a new OptimisticLockException exception with the specified cause.

public
OptimisticLockException(Object
the entity.
entity
)

Constructs a new OptimisticLockException exception with the specified entity.

public
OptimisticLockException(String
the detail message.
message
,
Throwable
the cause.
cause
,
Object
the entity.
entity
)

Constructs a new OptimisticLockException exception with the specified detail message, cause, and entity.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the entity.
getEntity
()

Returns the entity that caused this exception.

Field Detail

entityback to summary
pack-priv Object entity

The object that caused the exception

Constructor Detail

OptimisticLockExceptionback to summary
public OptimisticLockException()

Constructs a new OptimisticLockException exception with null as its detail message.

OptimisticLockExceptionback to summary
public OptimisticLockException(String message)

Constructs a new OptimisticLockException exception with the specified detail message.

Parameters
message:String

the detail message.

OptimisticLockExceptionback to summary
public OptimisticLockException(String message, Throwable cause)

Constructs a new OptimisticLockException exception with the specified detail message and cause.

Parameters
message:String

the detail message.

cause:Throwable

the cause.

OptimisticLockExceptionback to summary
public OptimisticLockException(Throwable cause)

Constructs a new OptimisticLockException exception with the specified cause.

Parameters
cause:Throwable

the cause.

OptimisticLockExceptionback to summary
public OptimisticLockException(Object entity)

Constructs a new OptimisticLockException exception with the specified entity.

Parameters
entity:Object

the entity.

OptimisticLockExceptionback to summary
public OptimisticLockException(String message, Throwable cause, Object entity)

Constructs a new OptimisticLockException exception with the specified detail message, cause, and entity.

Parameters
message:String

the detail message.

cause:Throwable

the cause.

entity:Object

the entity.

Method Detail

getEntityback to summary
public Object getEntity()

Returns the entity that caused this exception.

Returns:Object

the entity.