Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsIssue with orphanRemoval = true and OptimisticLockException
https://www.eclipse.org/forums/index.php/mv/msg/683645/1283786/#msg_1283786
@Transactional
public doit(Long id) {
MyEntity e = findEntity(id);
List<Thing> things = e.getThings();
things.clear();
Thing newThing = new Thing();
newThing.merge();
things.add(newThing);
e.merge();
}
In that example, the MyEntity.things collection is the @OneToMany with orpahnRemoval. It seems that at both lines were merge() is called, EclispeLink calls CommitManager.deleteAllObjects(). So the when the newThing is merged it deleted the contents of things that was cleared. When e is merged, it tries to delete again and throws OptimisticLockException.
Has anyone seen this before?
Thank you!]]>Dan Mising name2014-04-03T20:34:12-00:00Re: Issue with orphanRemoval = true and OptimisticLockException
https://www.eclipse.org/forums/index.php/mv/msg/683645/1290936/#msg_1290936
Chris Delahunt2014-04-10T15:18:22-00:00