-->
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: Want to enter data in pqarent table and not it child table
PostPosted: Mon Jul 28, 2008 2:19 am 
Newbie

Joined: Mon Jul 28, 2008 1:59 am
Posts: 1
Hi
I am using a table per class structure, where i have a parent class and 3 subclasses of the same. the hbm is like this.

<hibernate-mapping package="ABC">

<class name="A" table="A_TB" optimistic-lock="version">

<id name="id" length="36" column="ID">
<generator class="assigned" />
</id>

<discriminator column="TYPE" type="string" length="50" />

<property name ="xyz"/>
<property name="resultTypeId"/>

<subclass name="B" discriminator-value="b">
<join table="B_TB">
<key column="ID" />

<property name="PQR" type="java.lang.String"/>

</join>
</subclass>

<subclass name="C" discriminator-value="c">
<join table="C_TB">
<key column="ID" />

<property name="LMN" type="java.lang.String"/>

</join>
</subclass>
</class>

The class "B" and "C" extend "A". "A" is an abstract class. So entry in the tables could be made by only instantiating the child classes that is "B" and "C". Now for certain values of "resultTypeId" in "A" I want the entry should go only in the parent table that is "A" and not in the child table that is "B" or "C".
How can this be made possible ?


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.