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

Bug 544202 - Fix CacheKey.protectedForeignKeys update #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajacob
Copy link
Contributor

@ajacob ajacob commented Feb 8, 2019

Problem

There is an issue with 2nd level cache and @NonCacheable where a relationship could be not refreshed correctly.

To reproduce this problem you need:

  • To disable 2nd level cache globally (eclipselink.cache.shared.default false)
  • An entity EntityA configured for 2nd level caching (eclipselink.cache.shared.EntityA true)
  • An entity EntityB not configured for 2nd level (default)
  • EntityA needs to have a relation (tested with @ManyToOne) with EntityB, this relation needs to be annotated with @Noncacheable.

If you fetch an instance of EntityA a1 linked with an instance of EntityB b1, and then you update a1 to be linked with b2, foreign key cache will not be updated correctly and a1 will remain linked with b1.
The first attempt to re-load a1 will bring correctly b2 but all subsequent calls will bring back b1.

Solution

Fixed this problem by updating foreign key values when CacheKey is in CACHE_KEY_INVALID state.

@eclipsewebmaster
Copy link

Issue tracker reference:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=544202

1 similar comment
@eclipsewebmaster
Copy link

Issue tracker reference:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=544202

*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
******************************************************************************/

Copy link
Member

Choose a reason for hiding this comment

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

can you follow the convention used in other files wrt formatting of license header? I do not think this is going to pass the copyright check - verify by running mvn -Pcoding-standards glassfish-copyright-mave-plugin:check or mvn -Pcoding-standards glassfish-copyright-mave-plugin:copyright (the latter will show wrong files but won't fail the build in case of errors) - note that the check may take up to 2hours to finish

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @lukasj, thank you for your attention, I fixed the copyright as you suggested.
I ran:
mvn -X -Pcoding-standards glassfish-copyright:copyright -pl foundation/org.eclipse.persistence.core
And can confirm it ends with a BUILD SUCCESS and no reported errors.

I rebased master on my branch in order to be up to date

Copy link
Contributor Author

@ajacob ajacob May 1, 2020

Choose a reason for hiding this comment

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

Updated PR's description. Everything was already in bugzilla + test case but it's better to sum up here for future reference

Signed-off-by: Alexandre Jacob <alexandref.jacob@gmail.com>
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.

None yet

3 participants