Yes, you can use @OrderBy to order your queries.
@OrderBy("startTimeHrs, startTimeMins") @OneToMany(...) getBobjects() { return bobjects; }
Now when you say A.getBobjects() , they will be ordered. However, if you use the EntityQuery method to get the result, you can override getEjbql() and place the order there.
@Name("bList") public class B extends EntityQuery { @Override public String getEjbql() { return "select b from B b order by startTimeHrs, startTimeMins"; } }
Or you can @Override getResultList() manipulate the collection there in your entities
Shervin asgari
source share