LazyInit error in JPA/JTA with Hibernate bytecode enhanced dirty check

Description

We´ve tried out the Hibernate dirty check by bytecode enhancement via the Maven plugin (hibernate-enhance-maven-plugin) in version 5.2.6.
Simple JUnit tests run quite good. But we encountered strange LazyInit exceptions on OneToMany mappings when running the same code inside a JEE container (Wildfly 8) although the collection is tagged with FetchType.EAGER!

When running the code without the dirty-check bytecode enhancement everything worked fine.

A similar exception was reported in and so I tried out the Hibernate version 5.2.10 but with the same effect.

The stack trace:

I don´t understand why there is a lazy init exception when the collection is configured with FetchType.EAGER:

When changing the FetchType to LAZY the exception doesn´t occur anymore...

But as said before: the code works when running without the bytecode enhancement. And it also works with bytecode enhancement but outside of a container.

Please let me know if you need more information about the problem.

Environment

None

Assignee

Unassigned

Reporter

Joachim Glink

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure