@@ -149,7 +149,9 @@ public DeclaredQueryLookupStrategy(EntityManager em, JpaQueryMethodFactory query
149
149
@ Override
150
150
protected RepositoryQuery resolveQuery (JpaQueryMethod method , EntityManager em , NamedQueries namedQueries ) {
151
151
152
- String countQuery = getCountQuery (method , namedQueries , em );
152
+ if (method .isProcedureQuery ()) {
153
+ return JpaQueryFactory .INSTANCE .fromProcedureAnnotation (method , em );
154
+ }
153
155
154
156
if (StringUtils .hasText (method .getAnnotatedQuery ())) {
155
157
@@ -158,23 +160,18 @@ protected RepositoryQuery resolveQuery(JpaQueryMethod method, EntityManager em,
158
160
"Query method %s is annotated with both, a query and a query name. Using the declared query." , method ));
159
161
}
160
162
161
- return JpaQueryFactory .INSTANCE .fromMethodWithQueryString (method , em , method .getAnnotatedQuery (), countQuery ,
163
+ return JpaQueryFactory .INSTANCE .fromMethodWithQueryString (method , em , method .getRequiredAnnotatedQuery (),
164
+ getCountQuery (method , namedQueries , em ),
162
165
evaluationContextProvider );
163
166
}
164
167
165
- RepositoryQuery query = JpaQueryFactory .INSTANCE .fromProcedureAnnotation (method , em );
166
-
167
- if (null != query ) {
168
- return query ;
169
- }
170
-
171
168
String name = method .getNamedQueryName ();
172
169
if (namedQueries .hasQuery (name )) {
173
- return JpaQueryFactory .INSTANCE .fromMethodWithQueryString (method , em , namedQueries .getQuery (name ), countQuery ,
170
+ return JpaQueryFactory .INSTANCE .fromMethodWithQueryString (method , em , namedQueries .getQuery (name ), getCountQuery ( method , namedQueries , em ) ,
174
171
evaluationContextProvider );
175
172
}
176
173
177
- query = NamedQuery .lookupFrom (method , em );
174
+ RepositoryQuery query = NamedQuery .lookupFrom (method , em );
178
175
179
176
if (null != query ) {
180
177
return query ;
0 commit comments