All @OneToOne entities within the same object are loaded while accessing just one of them

Description

Hello, I think I have a major issue with Lazy Loading in OneToOne relations.

Using

when I hit a entity.getChild() which is a OneToOne relation, every other OneToOne relations are loaded as well

I use the hibernate-enhance-maven-plugin as follow :

Example with A, B, C, D.
A is a table with only a column ID as a PK.
B, C and D share the same ID as A (so their PK is an FK towards A.ID)

same goes for C and D (no need to paste the classes).

In my DAO with an entityManager :

I forked the github test-case and created a testcase
https://github.com/vmeunier/hibernate-test-case-templates please see ORMUnitTestCase.java.
As I call the getB(), you can see all the others properties are fetched.

Any help is appreciated.
If I have anything wrong with my mapping please point it out for me.
I have tried to make the relations BiDirectionnal without success, the use of @MapsId as well... Nothing works.

We used bytecode enhancement in Hibernate 3 and we weren't facing this problem.

Thanks in advance.

Environment

Java 8, Spring Boot 2.1.6.RELEASE, Hibernate 5.3.10.Final

Assignee

Unassigned

Reporter

Vincent Meunier

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Feedback Requested

2019/07/15

Components

Affects versions

Priority

Critical
Configure