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.
<hibernate-mapping>
<class name="org.XXXXXXX.Contact" table="contact">
<id name="id" column="id" type="int" unsaved-value="null">
<generator class="native" />
</id>
Here is the SQL generated
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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Here is the important part of the stack trace:
org.hibernate.AssertionFailure: null id in org.XXXXXXX.Contact entry (don't flush the Session after an exception occurs)
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?