-->
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: A superclass-subclass mapping question
PostPosted: Sun Jun 22, 2008 1:24 pm 
Newbie

Joined: Fri Jun 20, 2008 2:16 pm
Posts: 6
Hello All,
I am having trouble mapping superclass/subclass relationship.

Code:
class abstract SuperNode {
int id;
}

class SubNode extends SuperNode {

SuperNode nodeL;
SuperNode nodeR;

}


How do I map nodeL and nodeR in SubNode?
If I use <one-to-one> mapping then it will hold reference to its SuperNode PK, but I would want to see SubNode table with having 2 columns each for nodeL and nodeR or a join table....how can i approach this situation?
I am using table per subclass approach (<joinded-subclass>)

Code:
<hibernate-mapping>
<class name="SuperNode" table="SuperNode">
     <id name="id" type="integer" column="id">
        <generator class="assigned"></generator>
     </id>
     <joined-subclass name="SubNode" table="SubNode">
        <key column="id"></key>
     </joined-subclass>
  </class>
</hibernate-mapping>


thanks all in advance

-kashyup


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.