Skip to main content



      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 05:33
Eclipse UserFriend
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: Thu Jul 17 10:21:38 EDT 2025

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

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

Back to the top