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.