refresh(entity, lockMode) - JPA EntityManager's method
Method javax.persistence.EntityManager
void refresh(
Object entity,
LockModeType lockMode
)
If the lock mode type is pessimistic and the entity instance is found but cannot be locked:
- the
PessimisticLockException
will be thrown if the database locking failure causes transaction-level rollback - the
LockTimeoutException
will be thrown if the database locking failure causes only statement-level rollback.
- Parameters:
-
entity
- entity instance -
lockMode
- lock mode
- Throws:
-
IllegalArgumentException
- if the instance is not an entity or the entity is not managed -
TransactionRequiredException
- if there is no transaction and if invoked on a container-managedEntityManager
instance withPersistenceContextType.TRANSACTION
or with a lock mode other thanNONE
-
EntityNotFoundException
- if the entity no longer exists in the database -
PessimisticLockException
- if pessimistic locking fails and the transaction is rolled back -
LockTimeoutException
- if pessimistic locking fails and only the statement is rolled back -
PersistenceException
- if an unsupported lock call is made
- Since:
- JPA 2.0