Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » IndirectList executes a contains() check on add(). Why?
IndirectList executes a contains() check on add(). Why? [message #1730076] Thu, 21 April 2016 09:33
Simon Eiersbrock is currently offline Simon EiersbrockFriend
Messages: 3
Registered: April 2010
Junior Member
Hi everybody,

the org.eclipse.persistence.indirection.IndirectList executes a contains() check inside the add method to prevent duplicate objects in the list. Why? Is this a feature that I do not understand? In my opinion this is a bug...
A java List can contain duplicates, only a java Set ensures no duplicates. So the IndirectList changes the behaviour of a List.

In my current project this causes an issue under this circumstances:

* Parent contains a List with ChildElements
* List is loaded LAZY
* ChildElement overrides equals()-Method to execute the equals-comparison only on its ID field (This simplifies a lot of things in my project so I do not want to change this)
* IDs of database objects are generated by the database (MSSQL with Identity column). A new instance of a child has the ID "null".

If I add more than one new child object to the list only the first object will get saved to the database (because the Indirect List assumes that the other child objects are duplicates of the first child)
Previous Topic:weaving errors with eclipseLink 2.6.2
Next Topic:EclipseLink Moxy Dynamic JAXB strange behavior for standard XSD restrictions
Goto Forum:
  


Current Time: Tue Apr 07 08:35:03 GMT 2020

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

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

Back to the top