Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Remove child entity from collection: Best practice?
Remove child entity from collection: Best practice? [message #964893] Tue, 30 October 2012 21:49 Go to next message
Christian Eugster is currently offline Christian EugsterFriend
Messages: 203
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hi,

I have following entity classes:

Tectonic and Level have each a list of TectonicsLevels which references both of them. A fourth entity class TectonicsLevelLink references TectonicsLevel one time as parent and one time as child. TectonicsLevel in turn has two collections, a parent and a child collection of TectonicsLevelLink.

My question is (as I tried a lot of configurations without success): What is best practice removing a TectonicsLevel? In OnToMany relationships I have cascadeType.ALL set and orphanRemoval="true". I always get an OptimisticLockException when I remove a TectonicsLevel.

Maybe someone can give me a hint, at least where I find some usefull information about that?

Thank you!
Re: Remove child entity from collection: Best practice? [message #973631 is a reply to message #964893] Tue, 06 November 2012 13:48 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Please include your code. An OptimisticLockException is thrown if the version does not match. For the version to match, you need to read the object in the same transaction and not have another transaction update the version before your commit.


James : Wiki : Book : Blog : Twitter
Previous Topic:Shallow update and non-nullable fields
Next Topic:Eclipselink and JPA
Goto Forum:
  


Current Time: Fri Mar 29 15:42:56 GMT 2024

Powered by FUDForum. Page generated in 0.03931 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top