hibernate/hibernate-orm · error · NoResultException
No result found for query [" + getQueryString() + "]
Error message
No result found for query [" + getQueryString() + "]
What it means
Error "No result found for query [" + getQueryString() + "]" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java:1392
}
}
@Override
@Nullable
public <R1> R1 getSingleResult(@Nonnull jakarta.persistence.sql.ResultSetMapping<R1> resultSetMapping) {
checkNotClosed();
try {
final var list = getResultList( resultSetMapping );
return list == null ? null : getSingleResult( list );
}
catch ( HibernateException e ) {
throw getExceptionConverter().convert( e, getQueryOptions().getLockOptions() );
}
}
private <R1> R1 getSingleResult(List<R1> results) {
if ( results.isEmpty() ) {
throw new NoResultException( "No result found for query [" + getQueryString() + "]" );
}
return uniqueElement( results );
}
@Override
@Nullable
public <R1> R1 getSingleResultOrNull(@Nonnull Class<R1> aClass) {
checkNotClosed();
try {
final var list = getResultList( aClass );
return list == null ? null : uniqueElement( list );
}
catch ( HibernateException e ) {
throw getExceptionConverter().convert( e, getQueryOptions().getLockOptions() );
}
}
@OverrideView on GitHub (pinned to fad1729dce)
Solutions
- Use getResultList() and handle the empty case instead of getSingleResult().
- Verify the procedure/query actually returns a row for the given parameters.
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/6ec199d4ef23a7d9.
Report an issue: GitHub.