wolli wrote:
Do you get an exception or is the object simply still there ?
Objects are still there - nothing happens, no exeptions. I read that I should delete object itself and its reference in parent collection...
wolli wrote:
Can you post the mappings and the code where you delete the child (code between session.BeginTransaction and session.Commit() or between session obening and flushing) ?
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Parent" table="Parent">
<id ...</id>
...
<bag name="Childs" lazy="false" inverse="true" cascade="all">
<key>
<column name="ParentId" not-null="true" />
</key>
<one-to-many class="Child" />
</bag>
</class>
</hibernate-mapping>
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Child" table="Child">
<id>...</id>
....
<many-to-one name="Parent" class="Parent" column="ParentId" not-null="true"/>
</class>
</hibernate-mapping>
I delete the child on offline client just adding it to the collection. Then I pass this collection on server and call Session.Delete for each element in this collection. Ids are guids, so I guess hnibernate can attach childs by guid-id and then just to delete it. But nothing happens. It only works when on the same transaction I update attached parents with deleted childs in their child collections.