-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Collections Order by associated table column
PostPosted: Fri Oct 10, 2008 1:27 pm 
Newbie

Joined: Fri Oct 10, 2008 1:15 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.