Hello,
I have a class that has a collection of objects as a property.
I'm using a "link" table/class (IDs map) between the parent class and the collection.
I don't know how to order the collection based on a property of the actual object (not of the "link" class).
See below my mapping file.
I want to order the SiteOptionsList collection by the OptionText property of the SiteOptionChild class.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="SiteOptionsParent" table="SiteOptions">
<id name="OptionID" type="Int32">
<generator class="identity" />
</id>
<property name="OptionText" type="String(128)"/>
<bag name="SiteOptionsList" lazy="false" order-by="?????????">
<key column="ParentOptionID"/>
<one-to-many class="SiteOptionsRel"/>
</bag>
</class>
<class name="SiteOptionsRel" table="SiteOptionRel">
<id name="RowID" type="Int32">
<generator class="identity" />
</id>
<property name="ParentOptionID" type="Int32" />
<many-to-one name="Child" column="ChildOptionID" class="SiteOptionChild" unique="true" />
</class>
<class name="SiteOptionChild" table="SiteOptions">
<id name="OptionID" type="Int32">
<generator class="identity" />
</id>
<property name="OptionText" type="String(128)" />
</class>
</hibernate-mapping>