3 Replies Latest reply on Dec 4, 2014 9:10 AM by Horia Chiorean

    Reordering reference list properties

    javagirlie Newbie

      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;

       

      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.

       

      We have upgraded to modeshape 4.1 today, but it's the same using modeshape 4.0.

       

      Is there another way of handling such reordering of list reference elements?

       

      Thanks in advance,

      Susanne