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
Standard non-JPA EntityNotFoundDelegate: invoked when a lazy proxy or internal load discovers that the row for the given identifier no longer exists in the database. It converts that discovery into an ObjectNotFoundException carrying entity name and id.
Solutions
- Verify the row with the given identifier actually exists in the database before loading.
- Use Session.get() (returns null) instead of load()/byId() with proxy if a missing row is an acceptable case, or handle EntityNotFoundException.
- Check for filter, tenant, or caching configurations that hide or stale the row, and for wrong identifier type/value mapping.
Defensive patterns
Strategy: validation
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.
Appendix: 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)