The case is already described in https://hibernate.atlassian.net/browse/HHH-9663 and I throught it's solved with version 5.2.10.
But the problem still available - see project in attachment.
The clue: the setting of dependent-entity on root-entity ant then setting it to null on root-entity happens in the same transaction!
If you have any questions/suggestions feel free to ask.
Tested with H2
I confirm that the problem is present in 5.3.6 and is triggered with both H2 and Postgres 9.
I confirm that the problem is present in 5.4.3, triggered with H2. I used Hibernate’s native session management to trigger this issue rather than the JPA EntityManager.
Is this issue currently in queue to be fixed or should I use workarounds for the foreseeable future? Either way I’m fine, but I’m starting a new project with Hibernate and wondering if there is a timetable for a fix here.