On Sun, May 9, 2010 at 9:53 PM, Diego Mijelshon <[email protected]>wrote:

> Can you show us how you are doing the delete?
>
>    Diego
>
>
>
> On Sat, May 8, 2010 at 22:43, bhart <[email protected]> wrote:
>
>> hello nhusers,
>>
>> im new to nhibernate and i just started a project to learn more about
>> this. my proble is that when i delete a child object associated with a
>> parent, the parent also was delete. this are my mapping
>>
>>
>> <class name="VARP.Data.BusinessObjects.TblReceptionCenter, VARP.Data"
>> table="[dbo].[tblReceptionCenter]" lazy="true">
>>                <id name="Id" column="[RcNo]">
>>                        <generator class="native" />
>>                </id>
>>                <property name="CenterName" column="[CenterName]" />
>>                <property name="Address" column="[Address]" />
>>                <property name="Telephone" column="[Telephone]" />
>>                <property name="Fax" column="[Fax]" />
>>                <property name="Email" column="[Email]" />
>>                <property name="Contact" column="[Contact]" />
>>                <bag name="TblReceptionCenterVisits" lazy="false"
>> cascade="all-
>> delete-orphan" inverse="true" >
>>                        <key column="[RcNo]"></key>
>>                        <one-to-many
>> class="TblReceptionCenterVisit"></one-to-many>
>>                </bag>
>>        </class>
>>
>>
>> <class name="VARP.Data.BusinessObjects.TblReceptionCenterVisit,
>> VARP.Data" table="[dbo].[tblReceptionCenterVisit]" lazy="true">
>>                <id name="Id" column="[VisitNo]">
>>                        <generator class="native" />
>>                </id>
>>                <property name="DateOfVisit" column="[DateOfVisit]" />
>>                <property name="Session" column="[Session]" />
>>                <property name="GuardianInvited" column="[GuardianInvited]"
>> />
>>                <property name="GuardianParticipateNo"
>> column="[GuardianParticipateNo]" />
>>                <property name="ASNumber" column="[ASNumber]" />
>>                <property name="NumberGroupSession"
>> column="[NumberGroupSession]" />
>>                <property name="RCStaffSession" column="[RCStaffSession]"
>> />
>>                <property name="OtherPartners" column="[OtherPartners]" />
>>                <property name="Interpreter" column="[Interpreter]" />
>>                <property name="EquipmentArrangeAndvance"
>> column="[EquipmentArrangeAndvance]" />
>>                <property name="Remarks" column="[remarks]" />
>>                <many-to-one name="TblReceptionCenter" column="[RcNo]"
>> class="TblReceptionCenter" />
>>                <bag name="RCVisitByNationalities" lazy="false"
>> cascade="all-delete-
>> orphan" inverse="true" >
>>                        <key column="[VisitNo]"></key>
>>                        <one-to-many
>> class="RCVisitByNationality"></one-to-many>
>>                </bag>
>>
>> <class name="VARP.Data.BusinessObjects.RCVisitByNationality,
>> VARP.Data" table="[dbo].[RCVisitByNationality]" lazy="true">
>>                <id name="Id" column="[Id]">
>>                        <generator class="native" />
>>                </id>
>>                <property name="Nationality" column="[Nationality]" />
>>                <property name="CountPerNationality"
>> column="[CountPerNationality]" /
>> >
>>                <property name="TotalAttendAllSession"
>> column="[TotalAttendAllSession]" />
>>                <property name="TotalInvitedAllSession"
>> column="[TotalInvitedAllSession]" />
>>                <property name="MaleCount" column="[MaleCount]" />
>>                <property name="FemaleCount" column="[FemaleCount]" />
>>                <property name="MaleCounselling" column="[MaleCounselling]"
>> />
>>                <property name="FemaleCounselling"
>> column="[FemaleCounselling]" />
>>                <many-to-one name="TblReceptionCenterVisit"
>> column="[VisitNo]"
>> class="TblReceptionCenterVisit" />
>>        </class>
>>
>> when i delete a child from RCVisitByNationality, the parent
>> TblReceptionCenterVisit also was deleted.
>>
>> hope you can enlighten me regarding this. thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>


i am deleting it by this at it was bound to gridview

_rcBusiness.VisitByNationality.RemoveAt[e.RowIndex]

where VisitByNationality is RCVisitByNationality list
then,i call save function to save the changes, but then it delete also the
>
> TblReceptionCenterVisit and RCVisitByNationality

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to