-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: persisting inherited objects
PostPosted: Tue Oct 11, 2005 2:47 am 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
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

_________________
sHeRiN
thanks for your ratings ...... :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.