[https://github.com/de313e/SpringEagerLoadingIssue|https://github.com/de313e/SpringEagerLoadingIssue|smart-link]
The above contains the test case to verify the bug
Possible workaround of issue
[https://github.com/de313e/SpringEagerLoadingIssue/pull/2|https://github.com/de313e/SpringEagerLoadingIssue/pull/2|smart-link]
The above test case and also workaround in Github is with h2 embedded database. Have tested the same code with local Postgresql database and the behavior is exactly the same. So this should be an issue in ORM layer.
Happens only when the *not owning side* has more than 1 fields mapped with {{@OneToOne}} which are declared as {{LAZY}} but from the owner side they are declared as {{EAGER}}.
In this example the not owning entity of {{User}} has 2 fields mapped with {{@OneToOne}}, namely {{UserSettings}} and {{UserTermsOfUse}} which are declared as {{LAZY}}.
The owning sides of relationship which are {{UserSettings}} and {{UserTermsOfUse}} have a {{EAGER}} relationship with the {{User}} entity. |
|