I want to get only Parent entity object excluding its child entity's. How to do that.
Set lazy=true and everything will be fine. That is the meaning of lazy!
Michael
From: nhu...@googlegroups.com [mailto:nhu...@googlegroups.com] On Behalf Of Usman Khan Mohammad
Sent: Thursday, December 06, 2012 6:15 AM
To: nhu...@googlegroups.com
Subject: [nhusers] Re: How to return only Parent Entity not including with child entity in Nhibernate?
I used bag concept. Whenever I Get the parent, all child entities also getting. I have a particular scenario that should get only parent entity.
In My hbm file I written as follows:
Parent Hbm file:
<bag name ="ChildEmployeeDetails" lazy="false" inverse="true" cascade="all">
<key column ="ParentEmployeeId" />
<one-to-many class ="ParentEmployee" />
</bag>
Child Hbm file:
<many-to-one name="ParentEmployee" class="ParentEmployee" column="ParentEmployeeId" lazy ="false"
cascade="all" />
Now, I Get the entity like,
var entity = session.Get<ParentEmployee>(id);
here I am getting both Parent and Child records. I want only Parent records not child. How to code?
On Tuesday, December 4, 2012 3:31:22 PM UTC+5:30, Usman Khan Mohammad wrote:
I want to get only Parent entity object excluding its child entity's. How to do that.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/TNqRWZYFctoJ.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.