Hibernate 3.2
I have 2 tables which have a many-many relation via a mapping table. I need to sort the collection based on the column ina ssociated table. I have read that hibernate Orderby does not support that. What could be a workaround?
Tables - BM->BM_REPORT ->Report
BM Report is my mapping table. I need to sort by the Report_ID column in Report table
Code:
My mapping in main entity(BM
@Entity
@Table(name = "BM")
public class BM implements Serializable {
private Set<BaseModelReport> reports = null;
@org.hibernate.annotations.CollectionOfElements
@JoinTable(name = "BM_REPORT", joinColumns = @JoinColumn (name = "BM_ID)
public Set<BMeport> getReports() {
return reports;
}
}
Thanks,
DN