hibernate/hibernate-orm · error · IllegalMutationQueryException

Not a NamedMutationMemento

Error message

Not a NamedMutationMemento

What it means

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

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/named/internal/AbstractSelectionMemento.java:153

		return lockScope;
	}

	@Override
	@Nullable
	public Timeout getLockTimeout() {
		return lockTimeout;
	}

	@Override
	@Nullable
	public Locking.FollowOn getFollowOnLockingStrategy() {
		return followOnLockingStrategy;
	}

	@Nonnull
	@Override
	public MutationQueryImplementor<R> toMutationQuery(@Nonnull SharedSessionContractImplementor session) {
		throw new IllegalMutationQueryException( "Not a NamedMutationMemento" );
	}

	@Nonnull
	@Override
	public <X> MutationQueryImplementor<X> toMutationQuery(@Nonnull SharedSessionContractImplementor session, @Nullable Class<X> targetType) {
		throw new IllegalMutationQueryException( "Not a NamedMutationMemento" );
	}


	@Nonnull
	@Override
	public QueryImplementor<R> toQuery(@Nonnull SharedSessionContractImplementor session) {
		return toSelectionQuery( session );
	}

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

View on GitHub (pinned to fad1729dce)

Solutions

  1. The memento is not a NamedMutationMemento. Only named update/delete queries can be used here; check the named query type.

When it happens

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

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/1a9767cd7f3677a2. Report an issue: GitHub.