diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NamedQueryMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NamedQueryMethod.java index 7f505a9f2e..5f8a8fc9ef 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NamedQueryMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/NamedQueryMethod.java @@ -71,7 +71,9 @@ class NamedQueryMethod implements MetaAttribute { .append(sessionVariableName) .append(".createNamedQuery(") .append(fieldName()) - .append(")"); + .append(", ") + .append( annotationMeta.importType( resultType( select, annotationMeta.getContext() ) ) ) + .append( ".class)"); for ( SqmParameter param : sortedParameters ) { declaration .append("\n\t\t\t.setParameter(")