Details
-
Bug
-
Resolution: Done
-
Major
-
4.0.0.Final, 4.1.0.Final
-
None
Description
Hello modeshape team,
we are using references and weak references in ordered collections (lists) like in the following example:
@JcrReference(weak = true) private List<Content> contents;
@JcrReference is an annotation from the JCROM framework we are using for mapping repository representations to java objects (https://code.google.com/p/jcrom/).
We have discovered difficulties in reordering the elements in such lists.
The elements of the list are stored in the correct order on initial save, but if we reorder the elements in the list and update the node (adding no additional elements and removing none of the existing elements) the indices of the list entries are not updated accordingly.
The reason may be located in SessionNode.updateReferences - there is a comment 'if an existing reference property was just updated with the same value, it is a no-op so we should just remove it from the list of changed properties'.
In our case the reference property has changed (even if it's only the indices of the collection elements that have changed) but the changes are not persisted as the collection elements are still the same.
In our case, the list contains references to e.g. articles or documents and those lists can be edited/sorted by an author, hence the order of the references in the list is important for us.
See discussion.