Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Development/JPA 2.0/ordered lists"

(New page: = Persisting Order = JPA 2.0 Root | [http://bugs.eclipse.org/249037 Enhancement Request] ==Issue Summary== JPA 2.0 specification has added functiona...)
 
(General Solution)
Line 10: Line 10:
  
 
==General Solution==
 
==General Solution==
 +
Ordered List support is currently available in EclipseLink.  Order of collection items is tracked and updates and merges occur as a result of changes.  What this feature requires is that an additional field be managed by EclipseLink that is not mapped in the object model, similar to the Uni-directional OneToMany mappings.  This additional field will store the index of each item in the collection.
  
 +
As all collection mappings will need to support this functionality the best approach is to make CollectionMapping able to write indexes.  ChangeRecords are already aware of order changes but the mappings are unable to write the changes.
  
 +
There is a potential enhancement that allows the provider to fabricate artificial indexes to allow for efficient insertion.  For example if there were 3 items in the list EclipseLink could assign index 1, 3, and 9 to these objects.  Order would be maintained and should another instance be inserted into the list only one row update would be required instead of the minimal two.  This should only be considered as a future enhancement to this feature.
  
 
==Work Required==
 
==Work Required==

Revision as of 16:18, 30 September 2008

Persisting Order

JPA 2.0 Root | Enhancement Request

Issue Summary

JPA 2.0 specification has added functionality requiring the provider to persist list item indexes when mapped by the user. The provider must also track changes to an index.

See JPA 2.0 ED section 9.1.36 for details.

General Solution

Ordered List support is currently available in EclipseLink. Order of collection items is tracked and updates and merges occur as a result of changes. What this feature requires is that an additional field be managed by EclipseLink that is not mapped in the object model, similar to the Uni-directional OneToMany mappings. This additional field will store the index of each item in the collection.

As all collection mappings will need to support this functionality the best approach is to make CollectionMapping able to write indexes. ChangeRecords are already aware of order changes but the mappings are unable to write the changes.

There is a potential enhancement that allows the provider to fabricate artificial indexes to allow for efficient insertion. For example if there were 3 items in the list EclipseLink could assign index 1, 3, and 9 to these objects. Order would be maintained and should another instance be inserted into the list only one row update would be required instead of the minimal two. This should only be considered as a future enhancement to this feature.

Work Required

  1. Develop model for testing
    approx ? days
  2. Update EclipseLink
    approx ? days -

Back to the top