How about your DOCUMENT mapping? What SQL are generated by NH when updating DOCUMENT in the first case (the expected) and in the second case (the unexpected)? Are they both similar/same SQL, e.g.: referencing to the same GROUP, the modified properties are what should be modified, etc?
Also, the way you update them? Are using the same or different session? Has the session been flushed and closed properly between separate updates? -- Regards, Maximilian Haru Raditya On Tue, Apr 26, 2011 at 6:10 AM, PLen <[email protected]> wrote: > Maybe my initial statement was confusing as I don't see how it could > be a mapping issue because we are talking about the same types of > objects. What I mean by that is that I have a mapping file for a > GROUP object. Each GROUP object has an IList of DOCUMENT objects. > When I do a search I get an ICollection of GROUP objects. If I update > a DOCUMENT that is in the IList for GROUP 1, why is NHibernate doing a > database update for that DOCUMENT when I do an update call for GROUP > 2, which has no relation to my DOCUMENT. The DOCUMENT should only be > updated when I do an UPDATE on GROUP 1. Obviously NHibernate is doing > the update of my DOCUMENT and that is my confusion. Given this, if it > still seems to be a mapping issue, can someone let me know what > it is about the mapping. > > Here is the GROUP object (the DOCUMENT I am referring to is a > RptDocumentBase object): > > public class RptIngestGroup { > public RptIngestGroup() { } > public virtual long IngestGroupId { get; set; } > public virtual IList<RptDocumentBase> RptDocumentBases { get; > set; } > } > > Here is the mapping file: > > <?xml version="1.0" encoding="utf-8"?> > <hibernate-mapping assembly="IcebergDatabaseAccess" > namespace="IcebergDatabaseAccess.Domain" xmlns="urn:nhibernate- > mapping-2.2"> > <class name="RptIngestGroup" table="ICEBERG.RPT_INGEST_GROUP" > lazy="true" > > <id name="IngestGroupId" type="Int64" column="INGEST_GROUP_ID"> > <generator class="sequence"> > <param name="sequence">ICEBERG.SEQ_RPT_INGEST_GROUP</param> > </generator> > </id> > > <bag table="ICEBERG.RPT_DOCUMENT_BASE" name="RptDocumentBases" > lazy="true" cascade="all"> > <key foreign-key="rpt_document_base_fk" > column="ingest_group_id" /> > <one-to-many class="RptDocumentBase"/> > </bag> > ......... > > > Thoughts? > > Thanks again - 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.
