22
22
import org .hibernate .reactive .query .sql .spi .ReactiveNamedNativeQueryMemento ;
23
23
import org .hibernate .reactive .query .sql .spi .ReactiveNamedSqmQueryMemento ;
24
24
25
+ import jakarta .persistence .TypedQueryReference ;
26
+
25
27
public class ReactiveNamedObjectRepositoryImpl implements NamedObjectRepository {
26
28
27
29
private final NamedObjectRepository delegate ;
@@ -31,12 +33,17 @@ public ReactiveNamedObjectRepositoryImpl(NamedObjectRepository delegate) {
31
33
}
32
34
33
35
@ Override
34
- public NamedSqmQueryMemento getSqmQueryMemento (String queryName ) {
36
+ public <R > Map <String , TypedQueryReference <R >> getNamedQueries (Class <R > resultType ) {
37
+ return delegate .getNamedQueries ( resultType );
38
+ }
39
+
40
+ @ Override
41
+ public NamedSqmQueryMemento <?> getSqmQueryMemento (String queryName ) {
35
42
return wrapSqmQueryMemento ( delegate .getSqmQueryMemento ( queryName ) );
36
43
}
37
44
38
45
@ Override
39
- public void visitSqmQueryMementos (Consumer <NamedSqmQueryMemento > action ) {
46
+ public void visitSqmQueryMementos (Consumer <NamedSqmQueryMemento <?> > action ) {
40
47
delegate .visitSqmQueryMementos ( action );
41
48
}
42
49
@@ -46,12 +53,12 @@ public void registerSqmQueryMemento(String name, NamedSqmQueryMemento descriptor
46
53
}
47
54
48
55
@ Override
49
- public NamedNativeQueryMemento getNativeQueryMemento (String queryName ) {
56
+ public NamedNativeQueryMemento <?> getNativeQueryMemento (String queryName ) {
50
57
return wrapNativeQueryMemento ( delegate .getNativeQueryMemento ( queryName ) );
51
58
}
52
59
53
60
@ Override
54
- public void visitNativeQueryMementos (Consumer <NamedNativeQueryMemento > action ) {
61
+ public void visitNativeQueryMementos (Consumer <NamedNativeQueryMemento <?> > action ) {
55
62
delegate .visitNativeQueryMementos ( action );
56
63
}
57
64
@@ -101,11 +108,11 @@ public void validateNamedQueries(QueryEngine queryEngine) {
101
108
}
102
109
103
110
@ Override
104
- public NamedQueryMemento resolve (
111
+ public NamedQueryMemento <?> resolve (
105
112
SessionFactoryImplementor sessionFactory ,
106
113
MetadataImplementor bootMetamodel ,
107
114
String registrationName ) {
108
- return wrap (delegate .resolve ( sessionFactory , bootMetamodel , registrationName ));
115
+ return wrap ( delegate .resolve ( sessionFactory , bootMetamodel , registrationName ) );
109
116
}
110
117
111
118
@ Override
@@ -118,17 +125,19 @@ public void close() {
118
125
delegate .close ();
119
126
}
120
127
121
- private static NamedQueryMemento wrap (final NamedQueryMemento namedQueryMemento ) {
128
+ private static NamedQueryMemento <?> wrap (final NamedQueryMemento <?> namedQueryMemento ) {
122
129
if ( namedQueryMemento == null ) {
123
130
return null ;
124
- } else if ( namedQueryMemento instanceof NamedSqmQueryMemento ) {
125
- return wrapSqmQueryMemento ( (NamedSqmQueryMemento ) namedQueryMemento );
126
- } else {
127
- return wrapNativeQueryMemento ( (NamedNativeQueryMemento ) namedQueryMemento );
131
+ }
132
+ else if ( namedQueryMemento instanceof NamedSqmQueryMemento ) {
133
+ return wrapSqmQueryMemento ( (NamedSqmQueryMemento <?>) namedQueryMemento );
134
+ }
135
+ else {
136
+ return wrapNativeQueryMemento ( (NamedNativeQueryMemento <?>) namedQueryMemento );
128
137
}
129
138
}
130
139
131
- private static NamedSqmQueryMemento wrapSqmQueryMemento (final NamedSqmQueryMemento sqmQueryMemento ) {
140
+ private static NamedSqmQueryMemento <?> wrapSqmQueryMemento (final NamedSqmQueryMemento <?> sqmQueryMemento ) {
132
141
if ( sqmQueryMemento == null ) {
133
142
return null ;
134
143
}
@@ -141,7 +150,7 @@ else if ( sqmQueryMemento instanceof ReactiveNamedSqmQueryMemento ) {
141
150
}
142
151
}
143
152
144
- private static NamedNativeQueryMemento wrapNativeQueryMemento (final NamedNativeQueryMemento nativeQueryMemento ) {
153
+ private static NamedNativeQueryMemento <?> wrapNativeQueryMemento (final NamedNativeQueryMemento <?> nativeQueryMemento ) {
145
154
if ( nativeQueryMemento == null ) {
146
155
return null ;
147
156
}
0 commit comments