title: Error dehydrating property value for class
body: <p>I am trying to insert a object but it throwns me the <code>Error: dehydrating property value for FrancosPoS.DBMapping.order.obs</code></p>
  
  <p>I've looked here for</p>
  
  <p><a href="https://stackoverflow.com/questions/10867390/nhibernate-error-dehydrating-property-what-the-heck-is-this">NHibernate: Error dehydrating property - What the heck is this?</a> ,</p>
  
  <p><a href="https://stackoverflow.com/questions/11482106/nhibernate-error-dehydrating-property-value">NHibernate - Error dehydrating property value</a> and</p>
  
  <p><a href="https://stackoverflow.com/questions/1902219/receiving-index-out-of-range-with-nhibernate">Receiving Index Out of Range with NHibernate</a>,
  but none of them worked.</p>
  
  <p>I have checked and re-checked my mapping to multiple columns declarations but did not find any problem.</p>
  
  <p>My clue is that the problem has something to do with the bigint on the MySQL database and the <code>identity generator</code>. When I change it to <code>increment</code> the dehydrating error goes away and the <code>Index out of range</code> exception appears.</p>
  
  <p>Additionally, this is happening on the <code>Session Save</code> call. With the <code>increment</code> generator, the error happens at <code>commit</code> time.</p>
  
  <p>Here is my order xml mapping:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;hibernate-mapping assembly="FrancosPoS" namespace="FrancosPoS.DBMapping" xmlns="urn:nhibernate-mapping-2.2"&gt;
  &lt;class name="order" table="`order`" lazy="true" &gt;
  &lt;id name="idOrder"&gt;
    &lt;generator class="identity" /&gt;
  &lt;/id&gt;
  &lt;many-to-one lazy="false" name="employee"&gt;
    &lt;column name="idEmployee" sql-type="bigint(20)" not-null="false" /&gt;
  &lt;/many-to-one&gt;
  &lt;many-to-one lazy="false" name="customer"&gt;
    &lt;column name="idCustomer" sql-type="bigint(20)" not-null="false" /&gt;
  &lt;/many-to-one&gt;
  &lt;many-to-one lazy="false" name="address"&gt;
    &lt;column name="idAddress" sql-type="bigint(20)" not-null="false" /&gt;
  &lt;/many-to-one&gt;
  &lt;property name="date"&gt;
    &lt;column name="date" sql-type="datetime" not-null="true" /&gt;
  &lt;/property&gt;
  &lt;property name="bakingTime"&gt;
    &lt;column name="date" sql-type="datetime" not-null="false" /&gt;
  &lt;/property&gt;
  &lt;property name="price"&gt;
    &lt;column name="price" sql-type="decimal(8,4)" not-null="true" /&gt;
  &lt;/property&gt;
  &lt;property name="cash"&gt;
    &lt;column name="cash" sql-type="tinyint(1)" not-null="false" /&gt;
  &lt;/property&gt;
  &lt;property name="credit"&gt;
    &lt;column name="credit" sql-type="tinyint(1)" not-null="false" /&gt;
  &lt;/property&gt;
  &lt;property name="houseNumber"&gt;
    &lt;column name="houseNumber" sql-type="bigint(20)" not-null="false" /&gt;
  &lt;/property&gt;
  &lt;property name="complement"&gt;
    &lt;column name="complement" sql-type="bigint(20)" not-null="false" /&gt;
  &lt;/property&gt;
  &lt;property name="obs"&gt;
    &lt;column name="obs" sql-type="varchar(350)" not-null="false" /&gt;
  &lt;/property&gt;
  
  &lt;bag name="orderPsi" table="ordPsi" cascade="all" inverse="true"&gt;
        &lt;key column="idOrdPastaI" /&gt;
        &lt;one-to-many class="ordPsi" /&gt;
  &lt;/bag&gt;
  &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>And the cs class:</p>
  
  <pre><code>public partial class order {
      public order() { }
      public virtual long idOrder { get; set; }
      public virtual employee employee { get; set; }
      public virtual customer customer { get; set; }
      public virtual address address { get; set; }
      public virtual System.DateTime date { get; set; }
      public virtual System.Nullable&lt;System.DateTime&gt; bakingTime { get; set; }
      public virtual string price { get; set; }
      public virtual System.Nullable&lt;int&gt; cash { get; set; }
      public virtual System.Nullable&lt;int&gt; credit { get; set; }
      public virtual System.Nullable&lt;long&gt; houseNumber { get; set; }
      public virtual System.Nullable&lt;long&gt; complement { get; set; }
      public virtual string obs { get; set; }
      public virtual IList&lt;ordPsi&gt; orderPsi { get; set; }
  }
  </code></pre>
  
  <p>Here is the inner exception followed by the stack trace:</p>
  
  <pre><code>"Parameter index is out of range."
  at MySql.Data.MySqlClient.MySqlParameterCollection.CheckIndex(Int32 index)
  at MySql.Data.MySqlClient.MySqlParameterCollection.GetParameter(Int32 index)
  at System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index)
  at NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value, Int32 index)
  at NHibernate.Type.NullableType.NullSafeSet(IDbCommand st, Object value, Int32 index, Boolean[] settable, ISessionImplementor session)
  at NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index)
  </code></pre>