Thanks Somu,
What I want is for the MQ_Transaction table to have the same PK that the Transaction table has, withouth explicitly setting it. The Transaction table has a Primary Key generated because I am using a sequence generator. But what about MQ_Transaction? What property should I use for the MQ_Transaction table, so that it can have the same Primary Key that the Transaction table had?
Following is my Transaction.hbn.xml:
Code:
<hibernate-mapping auto-import="true" default-lazy="true">
<class
name="TransactionVO"
table="cdhc.TRANSACTION"
>
<id
name="transaction_id"
type="java.lang.String"
column="transaction_id"
>
<generator class="sequence">
<param name="sequence">CDHC.TRANSACTION_ID_SEQ</param>
</generator>
</id>
<property
name="vendor_id"
type="java.lang.String"
column="vendor_id"
not-null="true"
length="50"
/>
<one-to-one
name="mq_transaction"
class="MQ_TransactionVO"
cascade="save-update"
/>
</class>
</hibernate-mapping>
Following is my MQ_Transaction.hbn.xml:
Code:
<hibernate-mapping auto-import="true" default-lazy="false">
<class
name="MQ_TransactionVO"
table="cdhc.MQ_TRANSACTION"
>
<id
name="mq_transaction_id"
type="java.lang.String"
column="transaction_id"
>
</id>
<one-to-one
name="transaction"
class="TransactionVO"
/>
<property
name="vendor_id"
type="java.lang.String"
column="vendor_id"
not-null="false"
length="24"
/>
</class>
</hibernate-mapping>