java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
jakarta.persistence.PersistenceException
jakarta.persistence.EntityNotFoundException
- All Implemented Interfaces:
Serializable
Thrown by the persistence provider when:
EntityHandler.get(java.lang.Class<T>, java.lang.Object)cannot return an instance of the requested entity type because there is no matching record in the database,- an entity reference obtained by calling
EntityManager.getReference(java.lang.Class<T>, java.lang.Object)is accessed but the reference has no corresponding record in the database, - an entity is passed to
EntityManager.refresh(java.lang.Object)orEntityAgent.refresh(java.lang.Object)and its record no longer exists in the database, - an entity is passed to
EntityManager.lock(java.lang.Object, jakarta.persistence.LockModeType), a pessimistic lock mode is requested, and the record no longer exists in the database.
If the persistence context is joined to an active transaction, the transaction is automatically marked for rollback when this exception is thrown.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newEntityNotFoundExceptionexception withnullas its detail message.EntityNotFoundException(Exception cause) Constructs a newEntityNotFoundExceptionexception withnullas its detail message.EntityNotFoundException(String message) Constructs a newEntityNotFoundExceptionexception with the specified detail message.EntityNotFoundException(String message, Exception cause) Constructs a newEntityNotFoundExceptionexception with the specified detail message. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
EntityNotFoundException
public EntityNotFoundException()Constructs a newEntityNotFoundExceptionexception withnullas its detail message. -
EntityNotFoundException
Constructs a newEntityNotFoundExceptionexception withnullas its detail message. -
EntityNotFoundException
Constructs a newEntityNotFoundExceptionexception with the specified detail message.- Parameters:
message- the detail message.
-
EntityNotFoundException
Constructs a newEntityNotFoundExceptionexception with the specified detail message.- Parameters:
message- the detail message.
-