I have a Spring Data Jpa repository extending PagingAndSortingRepositoryand QueryDslPredicateExecutor.
It points to a table containing an element that I want to develop using an aggregate function. I want to get everyone m.field1with help MIN m.field2.
So here is my request in the method annotation @Query:
select new x.xx.MyClass(m.field1, MIN(m.field2))
from MyClass m
group by m.field1, m.field2
and here is my repository interface method:
Page<MyClass> findMyClass(Predicate predicate, Pageable pageable);
It works even if it probably sucks the request, and there is a better way to do it.
But when I try to use a predicate, even with an empty one, I get:
org.hibernate.QueryParameterException: Position beyond number of declared ordinal parameters. Remember that ordinal parameters are 1-based! Position: 1;
nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: Position beyond number of declared ordinal parameters.
Remember that ordinal parameters are 1-based! Position: 1
So can it make it work, or do I need to go with a different implementation?