-->
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: How will I do this?
PostPosted: Thu Jul 17, 2008 9:41 pm 
Newbie

Joined: Tue Nov 22, 2005 12:47 am
Posts: 6
I have a class mapping where it has a subset of the same class like this:

Code:
<class name="com.app.beans.ContactEvents" table="ContactEventType">
       <id name="eventId" column="eventId">
          <generator class="assigned" />
       </id>
        <property name="date"         column="dateStamp"/>
        <property name="description"   column="description"/>
        <property name="eventCode"      column="eventCode"/>
        <property name="superTypeId"   column="superTypeId" />
        <property name="status"         column="status" />
        <set name="contents">
           <key column="superTypeId" />
           <one-to-many class="com.app.beans.ContactEvents"/>
        </set>
    </class>


Then, I only want to get parent ContactEvents with status='active' that will also hold a set of ContactEvents with status='active' as well.

Can I put a condition in this mapping definition itself? how?
Or how can I do it in HQL?

There are some similar mapping examples like this on the net (like the cat /kittens example), but, it doesnt mention on how to approach this kind of problem.
What if I only want to retrieve only multi-colored kittens?

Thank you in advance.


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.