hibernate/hibernate-orm · error · ObjectNotFoundException

No row with the given identifier exists for entity {}

Error message

No row with the given identifier exists for entity {}

What it means

Error "No row with the given identifier exists for entity {}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/internal/StandardEntityNotFoundDelegate.java:24

import org.hibernate.ObjectNotFoundException;
import org.hibernate.proxy.EntityNotFoundDelegate;

/**
 * Standard non-JPA implementation of {@link EntityNotFoundDelegate},
 * throwing the Hibernate-specific {@link ObjectNotFoundException}.
 *
 * @author Steve Ebersole
 */
public class StandardEntityNotFoundDelegate implements EntityNotFoundDelegate {
	/**
	 * Singleton access
	 */
	public static final StandardEntityNotFoundDelegate INSTANCE = new StandardEntityNotFoundDelegate();

	@Override
	public void handleEntityNotFound(String entityName, Object id) {
		throw new ObjectNotFoundException( entityName, id );
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Verify the row with the given identifier actually exists in the database before loading.
  2. Use Session.get() (returns null) instead of load()/byId() with proxy if a missing row is an acceptable case, or handle EntityNotFoundException.
  3. Check for filter, tenant, or caching configurations that hide or stale the row, and for wrong identifier type/value mapping.

When it happens

Trigger: Loading an entity by id finds no row and the delegate is configured to fail.

Common situations: EntityNotFoundException from a broken to-one association referencing a deleted row, or getReference on a nonexistent id.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/dcaa0b65bc61e90a. Report an issue: GitHub.