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?
|