What I'm really trying to do is specify an "ORDER-BY" clause in the set one-to-many description that is ONLY in the related class.
For example,
Assume I have these two mappings:
Code:
<class name="Table1" table="TABLE_1">
<id name="pk" column="T1_PK" type="string"/>
<!-- none of the other fields matter -->
<set name="table2s" inverse="true" order-by="??????">
<key column="T2_FK"/>
<one-to-many class="Table2"/>
</set>
</class>
<class name="Table2" table="TABLE_2">
<id name="pk" column="T2_PK" type="string"/>
<property name="sequence" column="SQNC" type="string"/>
<property name="description" column="DESC" type="string"/>
</class>
What I really want is for all my "Table2" objects retrieved in that set to be ordered by the "SQNC" column.
However, it seems like my only choice for "ORDER-BY" in this case is "T2_PK" and I DON'T want it ordered by it!
Is my only solution to use HQL? I'd much prefer to be able to use object loading...
Thoughts?
ps. if my mapping files don't explain my dilema here is a simple table printout that expresses my desire:
Code:
TABLE_1 TABLE_2
---------- | --------------
T1_PK | T2_PK
T2_FK | T2_COL2 #I WANT TO ORDER BY THIS COLUMN!
T1_COL3 | T2_COL3
T1_COL4 |