title: NHibernate: How to save a new entity without overwriting the parent:
body: <p>I'm wondering what the best design would be for persisteing a new child entity with NHibernate without accidentally overwriting the parent in the database. </p>
  
  <p>The problem I have is that the child entity will look something like this: </p>
  
  <pre><code>class Child
  {
      Parent Parent; 
      // other fields
  }
  </code></pre>
  
  <p>My problem is that the child has been supplied from the UI layer along with the ID of the parent, and that means that the Parent ref is basically uninitialized: It will have the ID populated but everything else null - because the only way to populate its fields would be an extra round trip to the database to read them.</p>
  
  <p>Now if I call <code>Session.SaveOrUpdate(child)</code> on NHibernate, what's going to happen with the parent. I don't want NHibernate to cascade save the uninitialized parent since that would just destroy the data in the database.  How would people approach this problem? Any best practices?</p>