hibernate/hibernate-orm · error · IllegalSelectQueryException

Not a NamedSelectionMemento

Error message

Not a NamedSelectionMemento

What it means

Error "Not a NamedSelectionMemento" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/named/internal/CriteriaMutationMementoImpl.java:105

		return new MutationQueryImpl( this, mutationAst, session );
	}

	@Nonnull
	@Override
	public QueryImplementor<T> toQuery(@Nonnull SharedSessionContractImplementor session) {
		return toMutationQuery( session, queryType );
	}

	@Nonnull
	@Override
	public <X> QueryImplementor<X> toQuery(@Nonnull SharedSessionContractImplementor session, @Nullable Class<X> javaType) {
		return toMutationQuery( session, javaType );
	}

	@Nonnull
	@Override
	public SelectionQueryImplementor<T> toSelectionQuery(@Nonnull SharedSessionContractImplementor session) {
		throw new IllegalSelectQueryException( "Not a NamedSelectionMemento", getHqlString() );
	}

	@Nonnull
	@Override
	public <X> SelectionQueryImplementor<X> toSelectionQuery(@Nonnull SharedSessionContractImplementor session, @Nullable Class<X> javaType) {
		throw new IllegalSelectQueryException( "Not a NamedSelectionMemento", getHqlString() );
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. The memento is not a NamedSelectionMemento. Use a named select query where a selection memento is required.

When it happens

Trigger: A named query memento is used as the wrong query kind: Not a NamedSelectionMemento

Common situations: Internal mix-up reusing a named selection memento as a mutation memento or vice versa (e.g. via getNamedQuery APIs).


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