From d779632f155d005170d0c5394358ef1f7cfe4835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Cedomir=20Igaly?= Date: Tue, 9 Jul 2024 11:02:38 +0200 Subject: [PATCH] Adding returnClass as createNamedQuery parameter will create TypedQuery and avoid irritating compilation time warnings --- .../org/hibernate/processor/annotation/NamedQueryMethod.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(")