Hi everyone,
When I persist object with embedded collection that is defined like
Code:
...
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
Code:
{timeInstant1, timeInstant2, timeInstant3}
in database it may look like
Code:
"values" : [
{ timeInstant2 }, { timeInstant1 }, { timeInstant3 }
]
List is initiated as an ArrayList.
Database is MongoDB
Hibernate version is 5.1.0.Beta3
Is there a way I can get the same order in a database as it is in a list?
Ordering after fetching data is not an option for me.
Thanks.