-->
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: Table alias problem with order-by of set
PostPosted: Thu Feb 10, 2005 10:51 am 
Newbie

Joined: Thu Feb 10, 2005 10:24 am
Posts: 1
Using Hibernate 2.1.4, Xdoclet 1.2.2 and following code fragment:
[code]/**
* @hibernate.set lazy="false" order-by="DISPLAY_ORDER asc"
* @hibernate.jcs-cache usage="read-write"
* @hibernate.collection-key column="PROFILE_ID"
* @hibernate.collection-many-to-many column="COLUMN_ID" class="model.Column" outer-join="true"
*/
private Set getColumns() {
return m_columns;
}
[/code]
where DISPLAY_ORDER is a field of the model.Column tabel

gives following hbm.xml content:
[code]<set name="columns"
table="columns"
lazy="false"
inverse="false"
cascade="none"
sort="unsorted"
order-by="DISPLAY_ORDER asc">
<jcs-cache usage="read-write"/>
<key column="PROFILE_ID"/>
<many-to-many class="model.Column"
column="COLUMN_ID"
outer-join="true"/>
</set>
[/code]

The generated SQL is:
[code]select columns0_.COLUMN_ID as COLUMN_ID__, columns0_.PROFILE_ID as PROFILE_ID__, column1_.ID as ID0_, column1_.NAME as NAME0_, column1_.LABEL as LABEL0_, column1_.DISPLAY_ORDER as DISPLAY_4_0_ from NI_PROFILE_COLUMN columns0_ inner join NI_COLUMN column1_ on columns0_.COLUMN_ID=column1_.ID where columns0_.PROFILE_ID=? order by columns0_.DISPLAY_ORDER asc
[/code]

How can I prevent that in the actual SQL order by clause, the association table alias is prefixed or specify that the order by clause content applies to the table reference by the association table?


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.