-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Redundant parameter in the Limit query #3242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is because we convert by default 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 hibernate/hibernate-orm#7579 to fix this. |
Thank you, @quaff |
Avoid calling `Query.setFirstResult(0)` which maybe generated sql contains unwanted `offset 0`. Fix spring-projectsGH-3242
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.
The text was updated successfully, but these errors were encountered: