FIX: prepare FindMap query for proper bean cache / DB access #2926
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.
This fixes #2916
Under rare cirumstances, it could happen, that wrong queries were generated (wrong bind parameter count) when findMap is used
idIn(1)
- so Bean#1 is in cache. SQL of this query wasid in (?)
cache-key of query wasList[IdIn[?1],]
idIn(1,2,3,4,5)
- Bean#1 is in cache, one bind value is removed. Sql-query wasid in (?,?,?,?)
. cache-key of query wasList[IdIn[?5],]
- Note: Cache says 5 params, sql has only 4idIn(3,4,5,6,7)
- We have 5 beans, so reuse queryList[IdIn[?5],]
- Bean#3,4,5 are in cache - so remove bind params. Two bind params for Bean#6+7 are left, but cached query has 4 SQL parameter (which is also wrong, it should be 5)