title: When to use inverse=false on NHibernate / Hibernate OneToMany relationships?
body: <p>I have been trying to get to grips with Hibernate's inverse attribute, and it seems to be just one of those things that is conceptually difficult. </p>
  
  <p>The gist that I get is that when you have a parent entity (e.g. Parent) that has a collection of Child objects using a <strong>one-to-many</strong> mapping, setting inverse=true on the mapping tells Hibernate that 'the other side (the Child) has responsibility to update itself to maintain the foreign key reference in its table'. </p>
  
  <p>Doing this appears to have 2 benefits when it comes to adding Children to the collection in your code, and then saving the Parent (with cascade-all set): <a href="http://nhprof.com/Learn/Alert?name=SuperfluousManyToOneUpdate" rel="noreferrer">you save an unneccessary hit on the database</a> (because without inverse set, Hibernate thinks it has two places to update the FK relationship), and according to the official docs:</p>
  
  <blockquote>
    <p>If the  column of a
     association is declared
    NOT NULL, NHibernate may cause
    constraint violations when it creates
    or updates the association. To prevent
    this problem, you must use a
    bidirectional association with the
    many valued end (the set or bag)
    marked as inverse="true".</p>
  </blockquote>
  
  <p>This all seems to make sense so far. What I don't get is this: when would you <strong>NOT</strong> want to use inverse=true on a one-to-many relationship?</p>