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.  [ 2 posts ] 
Author Message
 Post subject: Possible bug with "order-by" and "many-to-man
PostPosted: Mon Sep 03, 2007 5:53 am 
Newbie

Joined: Wed Jun 07, 2006 3:15 am
Posts: 14
I've used "order-by" when mapping 1-n relation to a bag several times with no issues. Trying to do so with a n-m relation unfortunately doesn't work.

In the example below I try to get the tags related to a document sorted by name.

Code:
<bag name="tags" access="field" table="document_tags" inverse="false" lazy="true" cascade="all-delete-orphan"  order-by="Name">
   <key>
      <column name="document_id" sql-type="int" not-null="true" />
   </key>
   <many-to-many class="MiddleLayer.Domain.Tag, MiddleLayer">
      <column name="tag_id" sql-type="int" not-null="true" />
   </many-to-many>
</bag>


If the order-by="Name" is present, the SQL that is generated prefixes the "Name" column with tha alias of the "document_tags" table. That means that it tries to sort with a "Name" column from the intermediate table instead of the "tags" table.

Is this a bug? Am I doing something wrong?

Tia,
Nikos.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 5:41 am 
Newbie

Joined: Fri Jul 20, 2007 6:02 pm
Posts: 12
I faced this problem, too.
What sort of a field in many-to-many association?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.