"Illegal attempt to associate a collection with two open sessions"Mean that
the session from where you have retrieved the collection is still active.

2009/6/16 Vels <[email protected]>

>
> Hi...how to set update cascade for many-to-one's child objects ?
>
> my Item object having list<Inward> and
> Outward object having many-to-one of Item
>
> when insert/update outward object,want to update
> Outward.Item.InwardList(0).IssuedQty=Outward.OutwardQty
>
> My mapping info:
>
>  <class name="Item" table="tblItemMaster" lazy="true">
>    <id name="ItemCode" column="ItemCode" type="Int64" unsaved-
> value="0">
>      <generator class="native"/>
>    </id>
>    <property name="ItemName" type="string" not-null="false"
> length="3000"/>
>
>    <bag name="InwardList" table="tblSupplyReceiptDetails"
> inverse="true" cascade="save-update"
>           collection-type="Collection.ObservableList`1
> [[emPowerBO.Inward, emPowerBO]], Collection">
>      <key column="ItemCode"/>
>      <one-to-many class="emPowerBO.Inward,emPowerBO"/>
>    </bag>
>  </class>
>
>  <class name="Inward" table="tblInwards" lazy="true">
>    <id name="InwardCode" column="InwardCode" type="Int64" unsaved-
> value="0">
>      <generator class="native"/>
>    </id>
>
>    <property column="InwardQty" type="Decimal" name="InwardQty" not-
> null="false" />
>    <property column="IssuedQty" type="Decimal" name="IssuedQty" not-
> null="false" />
>
>    <many-to-one  name="Item"  class="Item"  column="ItemCode"  not-
> null="true"
>      cascade="none"
>      />
>   </class>
>
>  <class name="Outward" table="tblOutwards" lazy="true">
>    <id name="OutwardCode" column="OutwardCode" type="Int64" unsaved-
> value="0">
>      <generator class="native"/>
>    </id>
>
>    <property column="OutwardQty" type="Decimal" name="OutwardQty" not-
> null="false" />
>
>    <many-to-one  name="Item" class="Item" column="ItemCode" not-
> null="true"
>      cascade="save-update"
>      />
>   </class>
>
> Outward.Item.InwardList(0).IssuedQty=Outward.OutwardQty
> when session.save(outward)
> if cascade="none", save success but not updation in tabel
> if cascade="save-update",getting "Illegal attempt to associate a
> collection with two open sessions"
>
> can you help me where i missed ?
>
> NH Version : 2.1.0
> VB.Net 3.5
> SQL 2005
> legacy database
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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