-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Ordered Set help
PostPosted: Mon Dec 18, 2006 9:30 am 
Beginner
Beginner

Joined: Fri Oct 06, 2006 7:11 am
Posts: 32
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>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.