I'm using hibernate 3 - I have a class Project with a SET collection of a class named FundingItem, currently mapped as:
Code:
<set name="fundingItems" lazy="false" order-by="QUARTERID desc">
<key column="PROJECTID" />
<one-to-many class="uk.gov.brightonhove.grants.pojo.FundingItem"/>
</set>
However, I need to order the fundingItems by the value of a field from a third object, which FundingItem is in a many-to-one with, mapped in the FundingItem.hbm.xml as:
Code:
<hibernate-mapping default-lazy="false">
<class name="uk.gov.brightonhove.grants.pojo.FundingItem" table="FUNDING_ITEMS">
...
<many-to-one name="fundSource"
class="uk.gov.brightonhove.grants.pojo.FundSource"
column="FUNDSOURCEID" />
</class>
</hibernate-mapping>
so if this was in hql I would go
Code:
select f from FundingItem as f where f.projectid = :id order by f.quarterid, f.fundSource.description desc
how do I express this in a mapping doc?
TIA[/code]