-->
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.  [ 3 posts ] 
Author Message
 Post subject: question related on-to-many relationship
PostPosted: Mon Apr 25, 2011 1:10 pm 
Newbie

Joined: Mon Apr 25, 2011 1:24 am
Posts: 2
Hi,
I have this one-to-many relationship. My requirement is when the parent object (one) is retrieved only certain child objects(many) should be retrieved based on a criteria and not all the child objects. For example , I have a "Partner" object & it has a set of "Process" objects , but when the "Partner" object is retrieved only certain "Process" objects should be retrieved such as only those having the porperty referenceType = "PRT_REG". Here is my mapping. Any help will be greatly appreciated.

<hibernate-mapping>

<class name="com.finacle.partner.Partner" table="Partner">
<id name="partnerKy" column="PARTNER_KY" type="java.lang.Integer">
<generator class="increment" />
</id>
<property name="partnerId" type="java.lang.String" column="PARTNER_ID" length="15" />
<property name="partnerName" type="java.lang.String" column="PARTNER_NAME" length="40" />
<property name="tin" type="java.lang.Integer" column="TIN" />
<property name="activeStatus" type="java.lang.Boolean" column="IS_ACTIVE" />
<property name="status" type="java.lang.String" column="STATUS" length="2" />
<set name="users" cascade="all">
<key column="partnerKy" />
<one-to-many class="com.finacle.partner.User" />
</set>
<set name="approvalHistory" cascade="all">
<key column="partnerKy" />
<one-to-many class="com.finacle.partner.ApprovalHistory" />
</set>
<set name="process" cascade="all">
<key column="partnerKy" />
<one-to-many class="com.finacle.partner.Process" />
</set>
<property name="updatedDtm" type="java.util.Date" column="UPDATED_DTM"/>
</class>
<class name="com.finacle.partner.Process" table="PROCESS">
<id name="processKy" column="PROCESS_KY" type="java.lang.Integer">
<generator class="increment" />
</id>
<property name="partnerKy" type="java.lang.Integer" column="PARTNERKY" />
<property name="processId" type="java.lang.String" column="PROCESS_ID" length="30" />
<property name="referenceType" type="java.lang.String" column="REFERENCE_TYPE" length="10" />
<property name="remApprCnt" type="java.lang.Integer" column="REM_APPR_CNT" />
<property name="updatedDtm" type="java.util.Date" column="UPDATED_DTM"/>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: Re: question related on-to-many relationship
PostPosted: Mon Apr 25, 2011 5:05 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Maybe you can do what you want with filters: http://docs.jboss.org/hibernate/core/3. ... te-filters


Top
 Profile  
 
 Post subject: Re: question related on-to-many relationship
PostPosted: Wed Apr 27, 2011 11:57 am 
Newbie

Joined: Mon Apr 25, 2011 1:24 am
Posts: 2
That really helped. Thanks for taking time to respond to my query.


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

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.