-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Keyset-scrolling queries add identifier columns twice when Sort
already sorts by Id
#2996
Comments
Similar issue occurs if I specified ordering in the method name:
If I call this method:
Then resulting SQL query contains two mistakes:
|
Lines 60 to 72 in 8cae8cd
Id shouldn't be added to sort if user provide explicit one, WDYT? @mp911de |
Sort
already sorts by Id
You're right, we should not add identifiers to |
We now avoid adding sort properties if they are already specified by Sort. Closes #2996
@mp911de It seems that id property will always be used for keyset scrolling, what if id property is not applicable for sort and we could scroll base on another unique property? |
id shouldn't be added to sort if sort property already provided. See spring-projectsGH-2996
Please file a new ticket to discuss this matter. We require a property to make the database rows uniquely identifiable to avoid skipping rows with the same sort value as their previous row. |
I've created #3013, should I file another ticket? |
That one is a pull request already. We can continue the discussion there. |
id shouldn't be added to sort if sort property already provided. See spring-projectsGH-2996
id shouldn't be added to sort if sort property already provided. See spring-projectsGH-2996
id shouldn't be added to sort if sort property already provided. See spring-projectsGH-2996
id shouldn't be added to sort if sort property already provided. See spring-projectsGH-2996
id shouldn't be added to sort if sort property already provided. See spring-projectsGH-2996
Hi
I have a repository with the following method:
I tried to use keyset-scrolling and specified createdAt and id as keyset properties. Also I added "createdAt" to sort properties:
The resulting SQL query uses following sort order: firstly createdAt, then id:
from ORDERS o1_0 where o1_0.createdAt>? or o1_0.createdAt=? and o1_0.id>? order by o1_0.createdAt,o1_0.id
But I need the opposite order (id and then createdAt). So I added "id" property to the Sort.by construction:
However the resulting SQL query contains ORDER BY clause where "id" column is specified twice:
from ORDERS o1_0 where o1_0.id>? or o1_0.id=? and o1_0.createdAt>? or o1_0.id=? and o1_0.createdAt=? and o1_0.id>? order by o1_0.id,o1_0.createdAt,o1_0.id
The text was updated successfully, but these errors were encountered: