Consider 2 'parent' and 'child' entities:
There is a bidirectional relation with cascade=all on both sides. In some cases, on attempt to do a merge operation on a mixed (attached/transient) graph of these kind of entities, two managed entities are being created for single transient 'parent' entity.
The easiest way to see what's going on is to examine attached test.
Set breakpoint to bug.CascadeAttachedDetachedTest.java:70 and run this test. When breakpoint fires, examine contents of the 'managedVehicle' object (see attached managedVehicle_bad_transport.png):
Here we see two attached entities created for transient $2to3 entity. The first one (managedVehicle.transports) is valid. The second one (managedVehicle.transports.pickupNode.pickupTransports) is invalid (all fields, including ID is null). Next step (s.flush() ) will result in 'not-null property name is null' error for that entity.