-->
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.  [ 4 posts ] 
Author Message
 Post subject: Many-to-Many and sorting
PostPosted: Mon Sep 22, 2003 10:09 am 
Regular
Regular

Joined: Thu Aug 28, 2003 6:30 am
Posts: 58
Hi alls.
How could i set "order-by" condition in such case:
Table A {
....
}

Table B {
....
position integer
}

A <-- many-to-many --> B = A <-- C -- > B
so my mapping looks like this:

<bag
name="listB"
table="table_C"
lazy="false"
inverse="false"
cascade="save-update"
>
<key
column="a_id"
/>

<many-to-many
class="MyB_Blass"
column="b_id"
outer-join="auto"
/>
</bag>

Now i want to order by list of N\MyB_Class, but if i write bag so:
<bag
name="listB"
table="table_C"
order-by="position"
...
>

The hibernate looks for "position" column in table C ont B.
How can i say hibernate to looks in table B column ?

Thank's


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2003 1:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The order-by attribute always refers to the "collection table". In the case of a many-to-many, this is the link table.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2003 1:41 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 6:30 am
Posts: 58
gavin wrote:
The order-by attribute always refers to the "collection table". In the case of a many-to-many, this is the link table.

Yes, i know it. And i asked it is possible to sort such many-to-many ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2003 2:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
please see the Hibernate documentation. it mentions several options.


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

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.