I have two Objects, Entries and Samples. Each entry has an associated set of Samples, and each Sample has a vote associated with it. I need to query the database for all Entries, but for each Entry I need the associated set of Samples sorted according to their vote attribute:
public Class Entry{
Set<Sample> samples;
}
public Class Sample{
int vote;
}
I tried to sort the list of Samples after I had performed the query, but this turned out to be a mess because can't cast between a hibernate set and a java set. Can somebody help me alter my query to have the result I need?
List<Entry> entries = jpaTemplate.find("from Entry");