Hi,
I've been looking around for a bit but cannot find much information on ordered sets.
I have 2 classes one of which contains a set of the other. I want to be able to return the set ordered by a column of the second class (STATEMENT_CODE).
In the CertType.hbm file I can order the set by either column in the table DPCS_TYPE_STATEMEMTS_ENABLED but I need to order the statements by the STATEMENT_CODE of the Statement class.
thanks for any help
CertType class
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="ie.gov.agriculture.dpcs.cert.CertType" lazy="false" table="DPCS_CERT_TYPE">
<id name="typeId" type="long" column="CERT_TYPE_ID" unsaved-value="0">
<generator class="sequence">
<param name="sequence">CERT_TYPE_ID_SEQ</param>
</generator>
</id>
<property name="certTypeDescription" column="DESCRIPTION" type="string"/>
<property name="createdBy" column="CREATED_BY" type="string"/>
<property name="createdDate" column="CREATED_DATE" type="string"/>
<set name="enabledStatements"
table="DPCS_TYPE_STATEMEMTS_ENABLED"
cascade="none">
<key column="CERT_TYPE_ID"/>
<many-to-many column="STATEMENT_ID"
class="ie.gov.agriculture.dpcs.cert.Statement"/>
</set>
</class>
</hibernate-mapping>
Statement class
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="ie.gov.agriculture.dpcs.cert.Statement" lazy="false" table="DPCS_STATEMENT">
<id name="statementId" column="STATEMENT_ID" unsaved-value="0" type="long">
<generator class="sequence">
<param name="sequence">STATEMENT_ID_SEQ</param>
</generator>
</id>
<property name="statement" column="STATEMENT" type="string" length="4000"/>
<property name="statementCode" column="STATEMENT_CODE" type="string"/>
</class>
</hibernate-mapping>