Hi,
Can you please elaborate on how the <generator> will be used for composite PK?. In my situation (see hbm below) XYZ_REQUEST_ID needs to be auto-generated from xyz.sequence_application_id sequence, and XYZ_REQUEST_SITE_ID is supplied by the application.
Code:
<class name="com.xyz.entity.Request"
table="XYZ_REQUEST" schema="XYZ">
<composite-id>
<key-property name="rqSiteId"
type="java.lang.String">
<column name="XYZ_REQUEST_SITE_ID" length="1" not-null="true" />
</key-property>
<key-property name="rqId" type="java.lang.Integer">
<column name="XYZ_REQUEST_ID" />
</key-property>
<generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
<param name="sequence_name">xyz.sequence_application_id</param>
<param name="initial_value">1</param>
<param name="increment_size">1</param>
</generator>
</composite-id>
The exception says :
Code:
org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short
at org.hibernate.id.IdentifierGeneratorFactory.createNumber(IdentifierGeneratorFactory.java:167)
at
How do we specify that only for one of the key-property we need to use the generator?