EntityManager.getReference is accessed but the entity does not exist.">
Jakarta Persistence (JPA) Class

jakarta.persistence.EntityNotFoundException

java.lang.Object
  java.lang.Throwable
    java.lang.Exception
      java.lang.RuntimeException
        jakarta.persistence.PersistenceException
          jakarta.persistence.EntityNotFoundException
Implemented Interfaces:
Serializable

Thrown by the persistence provider when an entity reference obtained by EntityManager.getReference is accessed but the entity does not exist. Thrown when EntityManager.refresh is called and the object no longer exists in the database. Thrown when EntityManager.lock is used with pessimistic locking is used and the entity no longer exists in the database.

The current transaction, if one is active and the persistence context has been joined to it, will be marked for rollback.

See Also:
Since:
Jakarta Persistence (JPA) 1.0

Public Constructors

Constructs a new EntityNotFoundException exception with null as its detail message.
Since:
Jakarta Persistence (JPA) 1.0
EntityNotFoundException(Exception cause)
Constructs a new EntityNotFoundException exception with null as its detail message.
Since:
Jakarta Persistence (JPA) 1.0
EntityNotFoundException(String message)
Constructs a new EntityNotFoundException exception with the specified detail message.
Parameters:
message - the detail message.
Since:
Jakarta Persistence (JPA) 1.0
EntityNotFoundException(String message, Exception cause)
Constructs a new EntityNotFoundException exception with the specified detail message.
Parameters:
message - the detail message.
Since:
Jakarta Persistence (JPA) 1.0

Additional JDK methods inherited from java.lang.Throwable

addSuppressed(Throwable), fillInStackTrace(), fillInStackTrace(int), getCause(), getLocalizedMessage(), getMessage(), getOurStackTrace(), getStackTrace(), getSuppressed(), initCause(Throwable), lockedPrintStackTrace(PrintStreamOrWriter), printEnclosedStackTrace(PrintStreamOrWriter,StackTraceElement~,String,String,Set), printStackTrace(), printStackTrace(PrintStream), printStackTrace(PrintStreamOrWriter), printStackTrace(PrintWriter), readObject(ObjectInputStream), setCause(Throwable), setStackTrace(StackTraceElement~), toString(), validateSuppressedExceptionsList(List), writeObject(ObjectOutputStream)

Additional JDK methods inherited from java.lang.Object

clone(), equals(Object), finalize(), getClass(), hashCode(), notify(), notifyAll(), wait(), wait(long), wait(long,int), wait0(long)