title: nHibernate: Fails to rollback complete operation
body: <p>We have a userobject split between two tables, a person table and user table.</p>
  
  <pre><code>public UserMap() 
  {
     Table("Person");
     Id(x =&gt; x.PersonId, "PersonId");
     Map(x =&gt; x.Name, "Name");
  
     Join("User", s =&gt; {
        s.Fetch.Join();
        s.KeyColumn("PersonId");
        s.Map(x =&gt; x.Username, "Username");
        s.Map(x =&gt; x.Password, "Password");
     });
  }
  </code></pre>
  
  <p>When doing a insert, nHibernate will first insert <code>Name</code> into the <code>Person</code> table, and then <code>Username</code> and <code>Password</code> into the <code>User</code> table. </p>
  
  <p><strong>The problem arise when the insertion into the <code>User</code>-table fails (like trying to insert a user with a username that is already taken). The transaction fails, but the insertion into the <code>Person</code> table is not rolled back.</strong></p>
  
  <pre><code>    public User Save(User user)
      {
          var session = SessionHelper.GetCurrent();
          using (var dbTransaction = session.BeginTransaction())
          {
              try
              {
                  session.SaveOrUpdate(user);
                  dbTransaction.Commit();
              }
              catch (Exception)
              {
  
                  dbTransaction.Rollback();
                  throw;
              }                
          }
  
          return user;
      }
  </code></pre>
  
  <p>Our SessionFactory is also set up with Fluent NHibernate</p>
  
  <pre><code>    public ISessionFactory BuildSessionFactory(string connectionString)
      {
          return Fluently.Configure().Database(OracleClientConfiguration.Oracle10.ConnectionString(c =&gt; c.Is(connectionString))
                                               .Provider&lt;OracleDriverConnectionProvider&gt;()
                                               .Driver&lt;OracleDataClientDriver&gt;()
                                               .ShowSql)
                                               .Mappings(m =&gt; m.FluentMappings.AddFromAssemblyOf&lt;UserMap&gt;())
                                               .BuildSessionFactory();
      }
  </code></pre>
  
  <p>I have put the logfile from a failing session <a href="https://gist.github.com/vegar/5458141" rel="nofollow">in a gist</a>. The <code>User</code> entity is a little more complex in real life, and there are some authentication stuff going on, so the log file want match 1:1 with the painted picture...</p>