My use case Since, with jpa, at runtime, you can't choose when to cascade operations and when not to on the same collection, I need to write a manual cascading mechanism. This issue is preventing me of achieving this task. The forum thread ended on this message
gbadner wrote: HHH-5716:
Because the Set has mappedBy=, elements should be removed via transport.setDeliveryNode( null ).
OK, back to fixing bugs...
Gail
Hi! I do not agree. The problem here is not that the collection is mapped using mappedBy. It could be also mapped directly.
The problem is, that it is LAZY loaded.
Why than this code works and I think is correct:
node.getDeliveryTransport().iterator(); node.getDeliveryTransport().clear();
But when ommiting the iterator() (which loads the lazy collections) the code fails:
node.getDeliveryTransport().clear();
I still think, this is a regular bug.
I also think this is a bug. Either clear method should never empty the set, either it should always empty it. |