title: Hibernate problems with Auto Increment ID MYSQL 5
body: <p>So, I just stood up a Spring Hibernate app and I can't seem to get my mapping file right. I am using MySql 5 and an auto incrementing key. Here is the ID portion of my mapping file.</p>
  
  <pre><code>&lt;hibernate-mapping&gt;
       &lt;class name="org.XXXXXXX.Contact" table="contact"&gt;
          &lt;id name="id" column="id" type="int" unsaved-value="null"&gt;
              &lt;generator class="native" /&gt;
          &lt;/id&gt;
  </code></pre>
  
  <p>Here is the SQL generated</p>
  
  <blockquote>
    <p>insert into contact (title, first_name, middle_name, last_name, suffix, job_title, dob, passport_number, passport_expiration, employer, dietary_restrictions, secondary_contact_fname, secondary_contact_lname, secondary_contact_mname, secondary_contact_title, secondary_contact_suffix, secondary_contact_job_title, emergency_contact_name, emergency_contact_phone, emergency_contact_notes, is_company) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)</p>
  </blockquote>
  
  <p>Here is the important part of the stack trace:</p>
  
  <p>org.hibernate.AssertionFailure: null id in org.XXXXXXX.Contact entry (don't flush the Session after an exception occurs)</p>
  
  <p>I have tried setting the unsaved-value to "0" and "-1" and sending them over the wire. Any ideas on what I am doing wrong?</p>