This may be super easy but I can’t find any clear statement about it in JPA specs. If I have a List-based relationship without @OrderBy annotation, e.g:
@OneToMany
List<Child> children;
then what will be order of this list elements in Java? It seems reasonable that this will be order of corresponding records in Child table or entries in intermetiate table if it’s many to many, but is that a guaranteed behavior of JPA providers?
Order is not guaranteed by the specification as far as I know. @OrderBy is the way to go if you depend on the order.
EDIT: Quote from JPA 1.0 spec:
(Page 19, Footnote [4])