Package org.hibernate

Class ObjectNotFoundException

java.lang.Object
java.lang.Throwable
All Implemented Interfaces:
Serializable

public classObjectNotFoundExceptionextendsUnresolvableObjectException
Thrown whenSession.find(Class, Object) fails to select a row with the given primary key (identifier value).

On the other hand, this exception might not be thrown immediately bySession.getReference(Class, Object) is called, even when there was no row on the database, becausegetReference() returns a proxy if possible. Programs should useSession.find() to test if a row exists in the database.

Like all Hibernate exceptions, this one is considered unrecoverable.

See Also:
  • Constructor Details

    • ObjectNotFoundException

      public ObjectNotFoundException(Object identifier,String entityName)
      Constructs aObjectNotFoundException using the given information.
      Parameters:
      identifier - The identifier of the entity
      entityName - The name of the entity
    • ObjectNotFoundException

      public ObjectNotFoundException(String entityName,Object identifier)