hibernate/hibernate-orm · error · UnknownNamedQueryException
No query named '{}'
Error message
No query named '{}' What it means
Error "No query named '{}'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/named/internal/NamedObjectRepositoryImpl.java:90
@Nullable
public <R> NamedQueryMemento<R> findQueryMementoByName(@Nonnull String name, boolean includeProcedureCalls) {
NamedQueryMemento<?> match = selectionMementos.get( name );
if ( match == null ) {
match = mutationMementos.get( name );
}
if ( includeProcedureCalls && match == null ) {
match = callableMementoMap.get( name );
}
//noinspection unchecked
return (NamedQueryMemento<R>) match;
}
@Override
@Nonnull
public <R> NamedQueryMemento<R> getQueryMementoByName(@Nonnull String name, boolean includeProcedureCalls) {
final var match = findQueryMementoByName( name, includeProcedureCalls );
if ( match == null ) {
throw new UnknownNamedQueryException( name );
}
//noinspection unchecked
return (NamedQueryMemento<R>) match;
}
@Override
@Nullable
public <R> NamedSelectionMemento<R> getSelectionQueryMemento(@Nonnull String name) {
//noinspection unchecked
return (NamedSelectionMemento<R>) selectionMementos.get( name );
}
@Override
@Nullable
public <R> NamedMutationMemento<R> getMutationQueryMemento(@Nonnull String name) {
//noinspection unchecked
return (NamedMutationMemento<R>) mutationMementos.get( name );
}View on GitHub (pinned to fad1729dce)
Solutions
- No named query with that name is registered. Check the name and that the @NamedQuery/@NamedNativeQuery class is scanned.
When it happens
Trigger: A named query is looked up that does not exist: No query named '<value>'
Common situations: Referencing a @NamedQuery by a misspelled or unregistered name.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/f8597b6d3386ca84.
Report an issue: GitHub.