hibernate/hibernate-orm · error · IllegalArgumentException
Unknown memento type: ${mementoClass}
Error message
Unknown memento type: ${mementoClass} What it means
Error "Unknown memento type: ${mementoClass}" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeMutationOrSelectionQueryImpl.java:63
/**
* Native query implementation used for the legacy untyped named-query API.
*/
public class NativeMutationOrSelectionQueryImpl
extends NativeQueryImpl<Object>
implements MutationOrSelectionQuery {
private final boolean mutation;
public static MutationOrSelectionQuery from(NamedNativeQueryMemento<?> memento, SharedSessionContractImplementor session) {
if ( memento instanceof NativeSelectionMementoImpl<?> selectionMemento ) {
return new NativeMutationOrSelectionQueryImpl( selectionMemento, session );
}
else if ( memento instanceof NativeMutationMementoImpl<?> mutationMemento ) {
return new NativeMutationOrSelectionQueryImpl( mutationMemento, session );
}
else {
throw new IllegalArgumentException( "Unknown memento type: " + memento.getClass() );
}
}
@Override
public boolean isSelectionQuery() {
return !mutation;
}
@Override
public boolean isMutationQuery() {
return mutation;
}
private NativeMutationOrSelectionQueryImpl(
NativeSelectionMementoImpl<?> selectionMemento,
SharedSessionContractImplementor session) {
super( selectionMemento, null, null, session );
mutation = false;View on GitHub (pinned to fad1729dce)
Solutions
- The memento object passed to the query is of an unknown type; only pass mementos produced by Hibernate's own toMemento() for this query kind.
- Recreate the query from the original query string instead of reusing a foreign memento.
When it happens
Trigger: A name referenced in the query or its configuration cannot be resolved at runtime.
Common situations: Typos in fetch-profile, memento, or table names, or references to objects that were never registered.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/28f0e1223409c17d.
Report an issue: GitHub.