I have a @OneToMany on a list:
Code:
@OneToMany
@Cascade({ALL, DELETE_ORPHAN})
public List<PriceTier> getPriceTiers() {
return priceTiers;
}
Chapter 2 in the annotations documentation says:
Quote:
The EJB3 specification describes how to map an ordered list (ie a list ordered at load time) using @javax.persistence.OrderBy annotation: this annotation takes into parameter a list of comma separated (target entity) properties to order the collection by (eg firstname asc, age desc), if the string is empty, the collection will be ordered by id.
When we run with HSQLDB everything works as expected. But when run with mysql the select to load the collection doesn't have an order by clause and mysql will return the results in the wrong order. My question is, do I need to specify an @OrderBy or can I use a List and rely on this ordering by id?