No problem, Peter. I'd like to see if I could offer any help here.

So, let me summarize your situation. Please clarify whether it's correct or
not:

   1. You have parent-child like domain model, the parent = Group, the child
   = Document/DocumentBase, with one-to-many relationship.
   2. You observed that updating a child from a parent causing other
   children from other parent to be update as well, when you expected they
   shouldn't be.
   3. You're updating the entity from the child side not from the parent
   one, but your mapping <bag /> doesn't have inverse=true attribute.

For point #3, how about adding inverse=true to your <bag /> mapping and
observe the difference. I'd suggest you to see section 20.2 (Bidirectional
one-to-many) in the NH doc.

Also, could you elaborate more your session usage pattern, the sequence I
mean. For example:
- Open ISession
- Load GROUP #1
- Update a property in DOCUMENT of GROUP #1
- Update DOCUMENT
- Flush ISession





-- 
Regards,

Maximilian Haru Raditya




On Tue, Apr 26, 2011 at 8:14 PM, PLen <[email protected]> wrote:


> Maximilian,
>
> Thanks for the continued reponses.  As for the DOCUMENT mapping, the
> domain object looks like:
>
> public class RptDocumentBase {
>        public RptDocumentBase() { }
>        public virtual long DocBaseId { get; set; }
>        public virtual RptIngestGroup RptIngestGroup { get; set; }  //
> The GROUP object
> }
>
> and the mapping file looks like:
>
> <hibernate-mapping assembly="IcebergDatabaseAccess"
> namespace="IcebergDatabaseAccess.Domain" xmlns="urn:nhibernate-
> mapping-2.2">
>
>  <class name="RptDocumentBase" table="ICEBERG.RPT_DOCUMENT_BASE"
> lazy="true" >
>    <id name="DocBaseId" type="Int64" column="DOC_BASE_ID">
>      <generator class="sequence">
>        <param name="sequence">ICEBERG.SEQ_RPT_DOCUMENT_BASE</param>
>      </generator>
>    </id>
>       <many-to-one name="RptIngestGroup" column="INGEST_GROUP_ID"/>
> ...........
>
> The updates are using the NHibernate "Update" command where I pass in
> the object (ie the RptIngestGroup object).  As far as the session
> goes, I found out early on that I had to use the same session that was
> used to query for the data if I wanted to update the data.  So, yes, I
> am using the same session.  In the case that I have, I have only
> updated the in-memory DOCUMENT object from GROUP 1 when I go to do the
> NHibernate "update" of GROUP 2.  When looking at the output console,
> NHibernate shows an UPDATE command for my DOCUMENT, along with toehr
> UPDATE commands concerning any DOCUMENT objects that were part of
> GROUP 2.  Again, there is nothing that links my DOCUMENT to GROUP 2.
> It is almost as if NHibernate checks everything it got back from the
> query to see if any of the objects are different, regardless if they
> are attached to the object being sent in for the update.
>
> - Peter
>
> --
> 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.
>
>
>

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