Results 1 to 5 of 5

Thread: How to order Sets in Node

  1. #1
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default How to order Sets in Node

    Code:
    public class Event {
        @RelatedToVia(type = ITEMS_NEEDED_FOR_EVENT)
        @Fetch
        private Set<ItemNeededForEvent> itemsNeededForEvent;
    
        @RelatedTo(type = ItemUserIsBringingToEvent.EVENT_FOR_ITEM_BROUGHT, direction = Direction.INCOMING)
        private Set<ItemUserIsBringingToEvent> itemsBringingToEvent;
    }
    So if I load an Event the collection is populated, but how could I get it sorted for instance. If I change it to SortedSet, would that work? Is there anything in the annotation to set an order by when retrieving?

    Thanks

    Mark

  2. #2
    Join Date
    May 2012
    Posts
    107

    Default

    Quote Originally Posted by bytor99999 View Post
    Is there anything in the annotation to set an order by when retrieving?
    Nope.

    I'd try the SortedSet approach. Let me know what you find.

    Regards,

    Lasse

  3. #3
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    You can also try an @Query annotated field for loading the objects and use the cypher sorting. The default set-type is a HashSet though, so your sorting would be killed. Can you raise an issue so that we can use a SortedSet (like TreeSet) when the target field is of type SortedSet.

    Thx

    Michael

  4. #4
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    I raised a JIRA Issue, but forgot to post here, so forgot the number.

    Thanks

    Mark

  5. #5
    Join Date
    May 2012
    Posts
    107

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •