Uploaded image for project: 'Hibernate OGM'
  1. OGM-1236

Collections of elements should be stored and returned in the same order with MongoDB

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 5.1.0.CR1
    • Component/s: core
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      From the forum:

      When I persist object with embedded collection that is defined like

         ...
         private List<TimeInstant> values;
      
         @ElementCollection
         @Column(name = "values")
         public List<TimeInstant> getValues() {
            return values;
         }
      
         ....
      

      this collection got persisted in random order.
      I mean if my list is

      {timeInstant1, timeInstant2, timeInstant3}
      

      in database it may look like

      "values" : [ 
              { timeInstant2 }, { timeInstant1 }, { timeInstant3 }
      ]
      

      List is initiated as an ArrayList.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                davided Davide D'Alto
                Reporter:
                davided Davide D'Alto
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: