Skip to content
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

FIX: prepare FindMap query for proper bean cache / DB access #2926

Merged
merged 1 commit into from Jan 8, 2023

Conversation

rPraml
Copy link
Contributor

@rPraml rPraml commented Jan 4, 2023

This fixes #2916

Under rare cirumstances, it could happen, that wrong queries were generated (wrong bind parameter count) when findMap is used

  • fetch idIn(1) - so Bean#1 is in cache. SQL of this query was id in (?) cache-key of query was List[IdIn[?1],]
  • fetch idIn(1,2,3,4,5) - Bean#1 is in cache, one bind value is removed. Sql-query was id in (?,?,?,?). cache-key of query was List[IdIn[?5],] - Note: Cache says 5 params, sql has only 4
  • fetch idIn(3,4,5,6,7) - We have 5 beans, so reuse query List[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)

@rbygrave rbygrave added this to the 13.11.1 milestone Jan 8, 2023
@rbygrave rbygrave merged commit 28bd018 into ebean-orm:master Jan 8, 2023
@rPraml rPraml deleted the prepare-query branch January 23, 2023 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BeanCache findMap in combination with findOne does not work.
2 participants