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 for #3381 - Empty OneToMany when overflowing LazyLoadBatchSize an… #3382

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

rbygrave
Copy link
Member

@rbygrave rbygrave commented Apr 4, 2024

…d mixed queries

14.0.0 via #3295 introduced this bug.

#3295 introduced a behaviour where bulk updates clear the persistence context. Now the lazy loading of a BeanCollection works with an assumption that the "parent bean" is in the persistence context (and this assumption is broken with that change for this test case). That is, the bulk update is clearing the persistence context - removing the parent bean BEFORE the lazy loading is invoked ... and that doesn't then work because the parent bean isn't in the persistence context.

This fix means that when lazy loading many's, the parent beans are putIfAbsent into the persistence context.

…d mixed queries

14.0.0 via #3295 introduced this bug.

 #3295 introduced a behaviour where bulk updates clear the persistence context. Now the lazy loading of a BeanCollection works with an assumption that the "parent bean" is in the persistence context (and this assumption is broken with that change for this test case). That is, the bulk update is clearing the persistence context - removing the parent bean BEFORE the lazy loading is invoked ... and that doesn't then work because the parent bean isn't in the persistence context.

 This fix means that when lazy loading many's, the parent beans are putIfAbsent into the persistence context.
@rbygrave rbygrave self-assigned this Apr 4, 2024
@rbygrave rbygrave linked an issue Apr 4, 2024 that may be closed by this pull request
@rbygrave rbygrave added the bug label Apr 4, 2024
@rbygrave rbygrave added this to the 14.1.0 milestone Apr 4, 2024
bc.setLoader(server); // don't use the load buffer again
if (lazy) {
descriptor.contextPutIfAbsent(pc, parentId, parent);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix here really - descriptor.contextPutIfAbsent(pc, parentId, parent);

@rbygrave rbygrave merged commit c5ffccb into master Apr 4, 2024
1 check passed
@rbygrave rbygrave added the XL label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty OneToMany when overflowing LazyLoadBatchSize and mixed queries
1 participant