Fix orderBy for cached many requests #3485
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @rbygrave,
@rPraml and I have a test case in which we change the order of the ordered many properties.
We then load the parent with a find() and the details with getDetails().
The master bean is loaded from the cache, but the details are loaded directly from the database because they are not in the cache. However, @OrderColumn is not taken into account and the details are delivered in the wrong order. We have an easy fix for this in this PR.
We have observed that the queries are different when you get the parent bean from cache or from the database. We tried to refactor so that the same query is produced in both cases, see our next PR.
Can you please take a look and give us feedback?
Best regards
Noemi