Open sergey-morenets opened 7 months ago
This is because we convert by default Limit
into Pageable(0, limit)
and set the Query.setFirstResult(…)
value implicitly.
Actually, Hibernate could omit that value as not setting the offset and setting offset zero should yield the same result.
I will try to fix it at hibernate side.
I've created https://github.com/hibernate/hibernate-orm/pull/7579 to fix this.
I've created hibernate/hibernate-orm#7579 to fix this.
Thank you, @quaff
I've created hibernate/hibernate-orm#7579 to fix this.
Thank you, @quaff
FYI, Hibernate team decline that.
Hi
Spring Data JPA introduced new Limit functionality to provide dynamic limiting. So if earlier we wrote the following query:
and now we can use new approach:
List<Product> findBy(Limit limit);
But I noticed that resulting SQL in the first two queries was :
SELECT * from Product p1_0 fetch first ? rows only
And now it's:
SELECT * from Product p1_0 offset ? rows fetch first ? rows only
So why do we need additional parameter offset? I guess it's redundant and not needed here.