Note that there are some explanatory texts on larger screens.

plurals
  1. PONhibernate - why is it trying to insert existing parent row when inserting child
    primarykey
    data
    text
    <p>I don't understand why NHibernate is trying to insert the parent object - when the row already exists in the db - when I'm inserting the child row.</p> <p>Parent mapping:</p> <pre><code>&lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true"&gt; &lt;class name="ReportDistribution.Client.ReportMgr.Model.ClientReport, ReportDistribution.Client.ReportMgr.Model" table="ClientReport" lazy="false" dynamic-update="true"&gt; &lt;id name="Id" access="property" column="ReportID"&gt; &lt;generator class="assigned"&gt;&lt;/generator&gt; &lt;/id&gt; &lt;property name="MaxAge" access="property" /&gt; &lt;property name="DeleteUnread" access="property" /&gt; &lt;property name="Description" access="property" /&gt; &lt;property name="Name" access="property" /&gt; &lt;bag name="ClientPublications" cascade="all" lazy="false"&gt; &lt;key column="ReportID" /&gt; &lt;one-to-many class="ReportDistribution.Client.ReportMgr.Model.ClientPublication, ReportDistribution.Client.ReportMgr.Model" /&gt; &lt;/bag&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>Child mapping:</p> <pre><code>&lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true"&gt; &lt;class name="ReportDistribution.Client.ReportMgr.Model.ClientPublication, ReportDistribution.Client.ReportMgr.Model" table="ClientPublication" lazy="false" dynamic-update="true"&gt; &lt;id name="Id" access="property" column="PublicationID"&gt; &lt;generator class="assigned"&gt;&lt;/generator&gt; &lt;/id&gt; &lt;property name="CreatedOn" access="property" type="DateTime"&gt;&lt;/property&gt; &lt;property name="IsMarkedForDeletion" access="property"&gt;&lt;/property&gt; &lt;property name="IsDeleted" access="property"&gt;&lt;/property&gt; &lt;property name="HasBeenRead" access="property"&gt;&lt;/property&gt; &lt;property name="ReceivedOn" access="property" type="DateTime"&gt;&lt;/property&gt; &lt;property name="FileExtension" access="property"&gt;&lt;/property&gt; &lt;property name="IsDownloaded" access="property"&gt;&lt;/property&gt; &lt;property name="MustRead" access="property"&gt;&lt;/property&gt; &lt;many-to-one name="Report" class="ReportDistribution.Client.ReportMgr.Model.ClientReport, ReportDistribution.Client.ReportMgr.Model" lazy="false" column="ReportID"&gt; &lt;/many-to-one&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>The Parent class (Report) has property which is a collection of child classes. The Child class (Publication) has property which is the parent object.</p> <p>Thanks in advance....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload