I am using Hibernate 5.2.11 with Bytecode Enhancement.
All my entites are with @Proxy(lazy = false) and all my to-one relationships with @LazyToOne(LazyToOneOption.NO_PROXY).
In addition to that, to preserve the business logic of the system (we are migrating from Kodo to Hibernate) I needed to add to every @ManyToOne annotation CascadeType.PERSIST option.
It sometimes causes execution of the
Code:
org.hibernate.engine.internal.AbstractEntityEntry#isNullifiable
which ends up in the first condition
Code:
getStatus() == Status.SAVING
For some days I have been trying to provide a test case that reproduces the issue but I found it very hard to create, because when I am debugging the execution flow of cascading persist operation I have different result than when running the program in a normal way. When debugging line after line I reach the condition above and a field value becomes null (so the insert value does) but when running the test in a normal way, everything is okay.
Do you have any idea how to deal with it and why is this happening that I got different results with debug and without it?