Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
given below is the senario of my problem
* class Advice extends Transaction
* i've used table per sub class mapping to persist the classes
what i want to do is
1. persist a transaction object (working fine)
2. persist a advice object (working fine)
3. persist (add) a advice object for previously persisted transaction
object in step 1 ( here is my problem)
how can i add a row to advice class's table with primary key of the transaction table (which is already existing ) as its foreign key ?
correct me if i am going the wrong way
Hibernate version:
3.0.5
Mapping documents:
<hibernate-mapping package="test.persistence">
<class name="Transaction" table="transaction">
<id name="transactionId" column="txn_id" type="long" unsaved-value="0" >
<generator class="native"></generator>
</id>
<property name="authCode" column="auth_code" type="string"></property>
<property name="systemEntryDateTime" column="sys_entry_date_time" type="timestamp"></property>
<property name="systemExitDateTime" column="sys_exit_date_time" type="timestamp"></property>
<property name="msgType" column="msg_type" type="string"></property>
<property name="comments" column="comments" type="string"></property>
<joined-subclass name="Advice" table="advice">
<key column="txn_id"></key>
<property name="adviceType" column="advice_type" type="string"></property>
<property > . . . </property>
</joined-subclass>
</class>
Name and version of the database you are using:
postgresql 7.4