Hi all,

I have two classes:

Parent(1) and (*)Child.


I've spotted a weird situation. When I fetch a Parent object (with a
Child collection) using UniqueResult<Parent> and after that Update a
Parent (I didn't made any modifications on Parent nor any Child
objects) nhibernate inserts a new copy of each Child object into a
db.

Example:

We've got a one Parent entity P1 and four Child entities: C1, C2, C3,
C4 in the db. After a mentioned process (fetch + update) we'll got one
Parent P1 and eight Child entities - four original and four copies.


Could anyone explain me what happens?


More Info:

NH: 2.0.1.4

Parent.xml:

<hibernate-mapping namespace="namespace" assembly="assembly"
xmlns="urn:nhibernate-mapping-2.2">
<class name="namespace.Parent" table="parent" schema="schema">
<id name="ID" type="Int64">
      <column name="id" not-null="true" />
      <generator class="sequence">
        <param name="sequence">sequence_name</param>
      </generator>
    </id>

...


<bag name="Children" table="children" schema="schema" lazy="false"
inverse="true" cascade="all">
      <key column="id_parent" />
      <one-to-many class="Child" />
    </bag>


...


</class>
</hibernate-mapping>




Regards,
MiloszeS

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