Lazy Attribute Loading with PersistentAttributeInterceptable

Description

For Lazy ManyToOne/OneToOne mapping we used to impelement the FieldHandled interface and use the FieldHandler up til version 4.3.11.

After upgrading to 5.2.12, where the FieldHandler was replaced by the PersistentAttributeInterceptable the lazy annotated fields were loaded at the end of the transaction in the `flushIfNecessary` anyways. We managed to get it working by making the Transaction readonly, which was sufficient for our use case.

An example for reproducing the problem can be found in https://github.com/NoUsername/springDataPlay/tree/hibernate-lazy-one-to-one-issue
The log with the difference in the SQL statements is attached and shows the difference between Hibernate 4 and 5.

Environment

None

Assignee

Unassigned

Reporter

Pia Gerhofer

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

4.3.11

Affects versions

Priority

Minor
Configure