Reputation: 569
findByPointsBetween(Integer lowerlimit,Integer upperlimit);
is above equivalent to lowerlimit < Points < upperlimit
, or lowerlimit <= Points <= upperlimit
.
I want to write lowerlimit <= Points <= upperlimit
, for some query, can anybody help me to clarify the Between keyword, and help me to write my spring data jpa query, thanks in advance
Upvotes: 2
Views: 2652
Reputation: 2970
Between keyword works like "lowerlimit <= Points <= upperlimit". Between keyword in Spring Data Jpa is equal to this is Jpql:
… where x.startDate between ?1 and ?2
where Jpql between works with included boundaries. You can also test it by running a repository method using between and see the results. Put 1,2,3 to DB and call it like:
findByPointsBetween(1,2);
Upvotes: 1
Reputation: 390
I think variant lowerlimit <= Points <= upperlimit
is true. Because spring-data translate this to JPQL. And JPQL spec use this variant.
Upvotes: 3