I'm using Hibernate with an Informix database that has a parent table for the id values and a child text table. When inserting into the parent table the generated ID being returned by session.save() is always zero, even though the table does not allow zero and the actual generated id being inserted into the table is greater than zero. Because of this I cannot insert into the text table because of a constraint violation - the id of zero does not actually exist in the parent table so the text with an id of zero cannot be inserted into the text table.
The hibernate xml I have is as follows:
Code:
<hibernate-mapping>
<class name="org.hibernate.test.TestVo" table="Test_Table">
<id name="id" type="long">
<column name="Test_Id_Nbr" />
<generator class="identity" />
</id>
<property name="userid" type="string">
<column name="Last_Updt_Userid" length="10" not-null="false" />
</property>
<property name="timestamp" type="java.util.Calendar">
<column name="Last_Updt_Ts" not-null="false" />
</property>
<set name="descriptions" inverse="true" lazy="false">
<key>
<column name="Test_Id_Nbr" not-null="true" />
</key>
<one-to-many class="org.hibernate.test.TestTextVo" />
</set>
</class>
</hibernate-mapping>
I'm using the org.hibernate.dialect.InformixDialect dialect. Any help would be greatly appreciated.
Thanks!
Mike