Hi guys, I have a domain that has always worked with a many-to-many
relationship only on one side. It was version 2.1 GA
The relationship is something like this:

public class Person
{
   public IList<Address> Addresses { get; set; }
}

And the mapping is structured in the following way in the Person map
file:

    <idbag
        name="Addresses"
        cascade="all"
        table="tbl_many_to_many">
      <collection-id column="many_id_field" type="System.Int32">
        <generator class="identity" />
      </collection-id>
      <key
          column="person_id_field" foreign-key="yyy" />
      <many-to-many
          column="address_id_field"
          class="Address" foreign-key="xxx" />
    </idbag>

Usually I was saving the entities in this way:

Person person = new Person()
Address address = new Address()
person.Addresses.Add(person)

StartTx
Session.Save(person)
CommitTx

And NHibernate had always persisting the whole tree without any issue.
Since we upgraded to Nhb 3.1 all the existing many-to-many
structured in this way do not work anymore ...
It fires an INSERT on the table Person and an UPDATE with id =
"00000000-00..." to the table Address. The many to many table is not
even touched anymore and the
INSERT in the table Address is changed with an UPDATE ...

The only way to have it working is by issuing this code, which
personally I do not want to do:

Person person = new Person()
Address address = new Address()
person.Addresses.Add(person)

StartTx
Session.Save(address)
Session.Save(person)
CommitTx

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