No worries, mappings below:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="A" table="A" lazy="false">
<id name="Id" column="ID" type="int">
<generator class="native" />
</id>
<property name="Name" column="Name" type="string" />
<set name="BItems" inverse="true" lazy="true" cascade="delete-
orphan">
<key column="AId" />
<one-to-many class="B" />
</set>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="B" table="B" lazy="false">
<id name="Id" column="ID" type="int">
<generator class="native" />
</id>
<property name="Name" column="Name" type="string" />
<many-to-one name="A" column="AId" cascade="save-update" not-
null="true" />
</class>
</hibernate-mapping>
Thanks
Stefan
On Sep 13, 11:24 pm, "Dario Quintana" <[EMAIL PROTECTED]>
wrote:
> Hello
> Could you please add the mappings ?
>
> On Sat, Sep 13, 2008 at 10:34 AM, codemonkey <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
> > Another question, might be a bit silly but my brain is fried today,
> > Say I have 2 tables A and B, with a one to many between them:
>
> > A
> > --
> > Id
> > Name
>
> > B
> > ---
> > Id
> > AId
> > Name
>
> > If I do something like so:
>
> > A a = new A();
> > a.Id = 1;
> > a.Name = "name";
> > a.BItems = null;
>
> > // THEN UPDATE a
>
> > Even though the collection is set to null, the children still remain,
> > am I missing something here? If I were to load A then call
> > a.BItems.Clear() and update they are removed as I expect.
>
> > Cheers
>
> --
> Dario Quintanahttp://darioquintana.com.ar
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---