use of io.micronaut.data.model.runtime.StoredQuery in project micronaut-data by micronaut-projects.
the class AbstractQueryInterceptor method prepareCountQuery.
/**
* Prepares a query for the given context.
*
* @param methodKey The method key
* @param context The context
* @return The query
*/
protected final PreparedQuery<?, Number> prepareCountQuery(RepositoryMethodKey methodKey, @NonNull MethodInvocationContext<T, R> context) {
StoredQuery storedQuery = countQueries.get(methodKey);
if (storedQuery == null) {
Class rootEntity = getRequiredRootEntity(context);
storedQuery = storedQueryResolver.resolveCountQuery(context, rootEntity, Long.class);
countQueries.put(methodKey, storedQuery);
}
Pageable pageable = storedQuery.hasPageable() ? getPageable(context) : Pageable.UNPAGED;
// noinspection unchecked
return preparedQueryResolver.resolveCountQuery(context, storedQuery, pageable);
}
Aggregations