title: Nhibernate update problem - Parameter index is out of range
body: <p>I am having problem with updating data to database. I have a simple many-to-one Product - Group relationship:</p>
  
  <pre><code>    public class GroupInfoMapping : ClassMap&lt;GroupInfo&gt;
  {
      public GroupInfoMapping()
      {
          Table("`group`");
          Schema("tempdb");
          Id(x =&gt; x.Id)
              .GeneratedBy.Native();
          OptimisticLock.Version();
          Map(x =&gt; x.GroupName);
          Map(x =&gt; x.ParentId);
                         HasMany(x =&gt; x.Products)
                             .KeyColumn("GroupId")
                             .Inverse()
                             .Fetch.Select()
                             .AsSet();
                         //HasMany(x =&gt; x.Children)
                         //    .KeyColumn("Id")
                         //    .Inverse()
                         //    .Fetch.Select()
                         //    .Cascade.None()
                         //    .AsSet();
                         //References(x =&gt; x.Parent)
                         //    .Class(typeof(GroupInfo))
                         //    .Column("ParentId")
                         //    .Fetch.Select();
  
      }
  }
  
       public class ProductInfoMapping : ClassMap&lt;ProductInfo&gt;
  {
      public ProductInfoMapping()
      {
          Table("`product`");
          Schema("tempdb");
          Id(x =&gt; x.Id)
              .GeneratedBy.Native();
          OptimisticLock.Version();
                         Map(x =&gt; x.GroupId);
          Map(x =&gt; x.ProductName);
                         References(x =&gt; x.Group)
                           .Class(typeof(GroupInfo))
                           .Column("GroupId")
                           .Fetch.Select();
      }
  }
  </code></pre>
  
  <p>There is no difference if I change only the product data, it will not allow me to update with exception:
  Parameter index is out of range.</p>
  
  <p>If I add Not.Update() to Product Mapping for Group reference, I am able to update product data (but Group remains unreferenced). </p>
  
  <p>I am using MySql database and I am using one session per presenter. Why I cannot update both entity and its reference? I have commented out part for selfreferening the group, since this also creates problem when updating group only.</p>
  
  <p>Thanks,
  Goran</p>