I have a table with composite primary key. In this key, one column is auto increment column.
When i saved the object, the auto generated key of the composite primary key is not being updated in the saved object. I mean the auto generated value is not being populated in the saving object.
It perfectly populated when there is single column primary key with auto increment.
Please help me in resolving this.
Hibernate version: 3.2
Mapping documents:
<hibernate-mapping>
<class name="com.cmcltd.afpis.dbsystem.dbobjects.Printfeature"
table="PRINTFEATURE" schema="F7TMS">
<composite-id>
<key-property name="pfid" type="java.lang.Long">
<column name="PFID" precision="22" scale="0" />
</key-property>
<key-property name="digitNmbr"
type="com.cmcltd.afpis.enums.HibDigitCodes">
<column name="DIGIT_NMBR" />
</key-property>
</composite-id>
<property name="sid" type="java.lang.Long">
<column name="SID" precision="22" scale="0" />
</property>
<property name="impressionType"
type="com.cmcltd.afpis.enums.HibImpressionType" not-null="true">
<column name="IMPRESSION_TYPE"></column>
</property>
<property name="mnt">
<column name="MNT" not-null="true" />
</property>
<property name="status" type="java.lang.String">
<column name="STATUS" length="10" not-null="true" />
</property>
</class>
Code between sessionFactory.openSession() and session.close():
SlipImage si = new SlipImage();
si.setSid(12);
si.set..()
...
getHibernateTemplate().save(si);
Name and version of the database you are using: MySQL 5.1
Please help me in resolving this problem.
Thanks in advance,
Sridhar Reddy
|