hibernate/hibernate-orm · error · IllegalArgumentException
Mutation target types do not match : %s / %s
Error message
Mutation target types do not match : %s / %s
What it means
Error "Mutation target types do not match : %s / %s" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/specification/internal/MutationSpecificationImpl.java:364
throw new IllegalMutationQueryException(
"MutationSpecification only supports HQL or criteria statement references: "
+ statementReference.getName()
);
}
}
/**
* Used during construction. Mainly used to group extracting and
* validating the root.
*/
@Nonnull
private static <T> SqmRoot<T> resolveSqmRoot(
@Nonnull SqmDeleteOrUpdateStatement<T> sqmStatement,
@Nonnull Class<T> mutationTarget) {
final var mutationTargetRoot = sqmStatement.getTarget();
final var javaType = mutationTargetRoot.getJavaType();
if ( javaType != null && !mutationTarget.isAssignableFrom( javaType ) ) {
throw new IllegalArgumentException(
String.format(
Locale.ROOT,
"Mutation target types do not match : %s / %s",
javaType.getName(),
mutationTarget.getName()
)
);
}
else {
return mutationTargetRoot;
}
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- The mutation target types differ between specification and query. Use matching entity types.
When it happens
Trigger: A runtime precondition of the Hibernate query API is violated: Mutation target types do not match : <value> / <value>
Common situations: Application code or configuration calls the query API in a way that violates its documented contract; the interpolated values in the message identify the offending input.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/2b6b8edf0386ff87.
Report an issue: GitHub.