dplass wrote:
You specified generator=native, this uses either 'identity' or 'sequence' depending on the database. Which databse are you using? IIRC, if SQLServer or MySQL, you have to identify the column as an Identity column.
Thanks for your feedback. I am using MySQL 4.1.
If I change the mapping on the PaymentInformation object to use identity instead of native (which I understand is wrong), I get the following error.
java.sql.SQLException: Duplicate key or integrity constraint violation, message from server: "Duplicate entry '0' for key 1
I guess the problem in my case is that when the Order object is saved, the generated orderId value is not passed into the PaymentInformation object. Is there some sort of an inverse relationship that needs to be maintained between the two objects that I am not doing?
TIA
Changed mapping that threw the new exception.
Code:
<hibernate-mapping>
<class name="com.gpani.commerce.paytrust.beans.order.PaymentInformation" table="PAYMENTINFORMATIONS" dynamic-update="false" dynamic-insert="false">
<id name="orderId" column="ORDERID" type="java.lang.Long" unsaved-value="null">
<generator class="identity"></generator>
</id>
</class>
</hibernate-mapping>