Class EntityNotFoundException
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(Class, 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(Class, Object)is accessed but the reference has no corresponding record in the database, - an entity is passed to
EntityManager.refresh(Object)orEntityAgent.refresh(Object)and its record no longer exists in the database, - an entity is passed to
EntityManager.lock(Object, LockModeType), a pessimistic lock mode is requested, and the record no longer exists in the database.
If an EntityNotFoundException is thrown by an
EntityManager with a persistence context joined to
an active transaction, the transaction is automatically
marked for rollback when the 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 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
-