Issue with new entities after delete then merge [message #1161428] |
Tue, 29 October 2013 20:14 |
Rob Young Messages: 3 Registered: October 2013 |
Junior Member |
|
|
My group has been noticing an intermittent issue for a while on our integration tests, where we are testing a REST service that is basically a layer to JPA entities. The issue is that in thread A an Entity S is deleted, while in thread B we are logging some data to S, in sub tables (Entities). What we're seeing is Entity S is being deleted, but a new entity T is created. The subtable data in thread B is using the merge call, as we are updating an existing record.
What I think is happening, is that S is becoming detached from EclipseLink, and then when merge is called on it's sub entity, it is creating a new record. Is this a likely assumption? What I would like to happen is for the entity manager to throw an exception when I call merge on these now invalid sub children, as their parent is no longer valid in the system.
For what it's worth, the Entity S has cascade = CascadeType.ALL set for it's mappings to it's sub entities, but the sub entities do not have this defined for the link back to S.
Should I be using @PrivateOwned for the children of S?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03222 seconds