15
15
import java .util .TreeSet ;
16
16
17
17
import static org .hibernate .processor .util .StringUtil .nameToFieldName ;
18
- import static org .hibernate .processor .util .SqmTypeUtils .resultType ;
19
18
20
19
/**
21
20
* @author Gavin King
@@ -28,6 +27,7 @@ class NamedQueryMethod implements MetaAttribute {
28
27
private final boolean reactive ;
29
28
private final String sessionVariableName ;
30
29
private final boolean addNonnullAnnotation ;
30
+ private final String resultClass ;
31
31
32
32
public NamedQueryMethod (
33
33
AnnotationMeta annotationMeta ,
@@ -36,14 +36,16 @@ public NamedQueryMethod(
36
36
boolean belongsToRepository ,
37
37
@ Nullable String sessionType ,
38
38
String sessionVariableName ,
39
- boolean addNonnullAnnotation ) {
39
+ boolean addNonnullAnnotation ,
40
+ String resultClass ) {
40
41
this .annotationMeta = annotationMeta ;
41
42
this .select = select ;
42
43
this .name = name ;
43
44
this .belongsToRepository = belongsToRepository ;
44
45
this .reactive = Constants .MUTINY_SESSION .equals (sessionType );
45
46
this .sessionVariableName = sessionVariableName ;
46
47
this .addNonnullAnnotation = addNonnullAnnotation ;
48
+ this .resultClass = resultClass ;
47
49
}
48
50
49
51
@ Override
@@ -72,7 +74,7 @@ public String getAttributeDeclarationString() {
72
74
.append (".createNamedQuery(" )
73
75
.append (fieldName ())
74
76
.append (", " )
75
- .append ( annotationMeta .importType ( resultType ( select , annotationMeta . getContext () ) ) )
77
+ .append ( annotationMeta .importType ( resultClass ) )
76
78
.append ( ".class)" );
77
79
for ( SqmParameter <?> param : sortedParameters ) {
78
80
declaration
@@ -123,7 +125,7 @@ private void returnType(StringBuilder declaration) {
123
125
declaration
124
126
.append (annotationMeta .importType (Constants .LIST ))
125
127
.append ('<' )
126
- .append ( annotationMeta .importType ( resultType ( select , annotationMeta . getContext () ) ) )
128
+ .append ( annotationMeta .importType ( resultClass ) )
127
129
.append ("> " )
128
130
.append (name );
129
131
if ( reactive ) {
0 commit comments