Hi what I would like to do is retrieve a collection of files from a SPECIFIC FileType object sorted using fileName or any of the other parameters inside the File class mapping. Can this be done using Criteria or HQL? I tried specifing order-by on the set in the FileType but that failed. It is mapped as a many-to-many, from FileType to File. Here is the mapping info:
Code:
<hibernate-mapping>
<class name="FileType" table="fileType">
<id name="id" type="long" unsaved-value="null">
<generator class="identity"/>
</id>
<set name="files" cascade="none" lazy="true" table="fileType_file">
<key>
<column name="type_id" not-null="true"/>
</key>
<many-to-many class="File">
<column name="file_id" not-null="true"/>
</many-to-many>
</set>
<set name="fileAttributeTypes" cascade="none" lazy="true" table="fileType_fileAttributeType">
<key>
<column name="type_id" not-null="true"/>
</key>
<many-to-many class="FileAttributeType">
<column name="item_id" not-null="true"/>
</many-to-many>
</set>
<property name="name"/>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="File" table="file">
<id name="id" type="long" unsaved-value="null">
<generator class="identity"/>
</id>
<property name="date"/>
<property name="description">
<column name="description" sql-type="mediumtext"/>
</property>
<many-to-one name="fileData" outer-join="false" cascade="all" column="fileData_id" not-null="true" unique="true"/>
<property name="fileName"/>
<set name="fileAttributes" cascade="all-delete-orphan" lazy="true">
<key column="file_id"/>
<one-to-many class="FileAttribute"/>
</set>
<property name="length"/>
<property name="title"/>
</class>
</hibernate-mapping>
Any help is greatly appreciated!!
-David