i changed cascade="all"     ... but still same problem

 <bag name="MasterItemList" table="tblCategorisedItems"
cascade="all"
        collection-type="Collection.ObservableList`1
[[emPowerBO.MasterItem, emPowerBO]], Collection">
     <key column="CategoryCode"/>
     <many-to-many column="MasterItemCode"
class="emPowerBO.MasterItem,emPowerBO"/>
   </bag>



On Apr 6, 5:19 pm, James Crowley <[email protected]> wrote:
> You might want to check your cascade options? If you want orphaned entities
> to be removed, you need to set it to all-delete-orphans... but make sure you
> understand the implcations of this.
>
> Seehttp://ayende.com/Blog/archive/2006/12/02/NHibernateCascadesTheDiffer...
> more info.
>
> Hope that helps
>
> James
>
> 2009/4/6 Vels <[email protected]>
>
>
>
>
>
> > Hi...
>
> > I am working with VB.Net 2008, SQL 2005, NH2.0.1
>
> > followings are my mapping information:
>
> > <?xml version="1.0" encoding="utf-8" ?>
> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> >                   namespace="emPowerBO" assembly="emPowerBO"
> > schema="emPowerMasterV4.dbo">
> >  <class name="MasterCategory" proxy="MasterCategory"
> > table="tblCategories" lazy="true"
> >         discriminator-value="MasterCategory">
> >    <id name="CategoryCode" column="CategoryCode" type="Int64" unsaved-
> > value="0">
> >      <generator class="native"/>
> >    </id>
> >    <property column="CategoryName" type="string" name="CategoryName"
> > not-null="true" length="255"/>
>
> >    <bag name="MasterItemList" table="tblCategorisedItems"
> > cascade="none"
> >         collection-type="Collection.ObservableList`1
> > [[emPowerBO.MasterItem, emPowerBO]], Collection">
> >      <key column="CategoryCode"/>
> >      <many-to-many column="MasterItemCode"
> > class="emPowerBO.MasterItem,emPowerBO"/>
> >    </bag>
>
> >    </class>
> > </hibernate-mapping>
>
> > test 1 :MasterItemList.add(Masteritem1)
> >          :session.update(MasterCategory)
> >          :trans.Commit()
> >           works fine :) Masteritem1 added to my collection and table
> > too
>
> > test 2 :MasterItemList.add(Masteritem2)
> >          :session.update(MasterCategory)
> >          :trans.Commit()
> >          :Masteritem2 added to my collection and table too
>
> >          :MasterItemList.Remove(Masteritem1)
> >          :session.update(MasterCategory)
> >          :trans.Commit()
> >          :Masteritem1 removed from my collection but not deleted from
> > my table
>
> > test 3 :MasterItemList.remove(Masteritem1)
> >          :session.update(MasterCategory)
> >          :trans.Commit()
> >          : works fine :) Masteritem1 removed from my collection and
> > from table too
>
> >          :MasterItemList.Remove(Masteritem2)
> >          :session.update(MasterCategory)
> >          :trans.Commit()
> >          :not working :( Masteritem2 removed from my collection but
> > not from table
>
> > what could be the mistake ?
> > is my mapping informations correct ?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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