-->
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: mapping questin for One table per concrete class inheritance
PostPosted: Tue Apr 12, 2005 5:49 pm 
Newbie

Joined: Tue Apr 12, 2005 5:44 pm
Posts: 1
[b]Hibernate version: 2.1.8

[b]Mapping documents: attached

[b]Name and version of the database you are using: oracle


I have concreteClass1 and concreteClass2 which are inherited from baseClass. I am using hibernate "One table per concrete class" inheritance model.

I have created total TWO TABLES,
one table for concreteClass1 --> concreteTable1 and
another table for concreteClass2 ---> concreteTable2

I have otherClass which contains COLLECTION(set) OF baseClasses(combination of concreteClass1 and concreteClass2). I am not sure how to write the mapping for this. I appreciate your help

<hibernate-mapping>
<class name="concreteClass1" table="concreteTable1" polymorphism="implicit">
<id name="id" column="CLASS1_ID" type="long">
<generator class="native">
<param name="sequence">seq1</param>
</generator>
</id>
<property name="concreteClassType" column="concrete_Class_Type_1" type="string"/>
.....other properties......
</class>

<class name="concreteClass2" table="concreteTable2" polymorphism="implicit">
<id name="id" column="CLASS2_ID" type="long">
<generator class="native">
<param name="sequence">seq1</param>
</generator>
</id>
<property name="concreteClassType" column="concrete_Class_Type_2" type="string"/>
.....other properties......
</class>
</hibernate-mapping>

<hibernate-mapping>
<class name="otherClass" table="otherClasstable">
<id name="id" column="other_class_id" type="long">
<generator class="native">
<param name="sequence">seq2</param>
</generator>
</id>

<!-- How to get set here instead of single entity--->
<any name="estate"
meta-type="string"
id-type="java.lang.Long">
<meta-value value="CLASS_1" class="concreteClass1"/>
<meta-value value="CLASS_1" class="concreteClass2"/>
<column name="REF_TYPE"/>
<column name="REF_ID"/>
</any>
....other properties...
</class>
</hibernate-mapping>


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.