-->
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.  [ 4 posts ] 
Author Message
 Post subject: InHeritance
PostPosted: Sun Jul 29, 2007 6:31 am 
Newbie

Joined: Sun Jul 29, 2007 6:21 am
Posts: 3
Hi there,
I have a simple question about Inheritance. As I read in the page (http://www.hibernate.org/hib_docs/nhibe ... tance.html), 3 methods are described to make inheritance. I've been searching google since yesterday but I couldn't find any useful information about my subject.

Imagine 2 classes, FirstClass and SecondClass. SecondClass inherits FirstClass. (class SecondClass : FirstClass ) Remember the second method, which is about making table for each class and using subclass-join tag.

The table which contains information about FirstClass should be OK, but I have some question marks about second table. As I inherit FirstClass, SecondClass has the inherited properties, and one more unique property which is not inherited, only defined on SecondClass. My question is about second table, which contains information about SecondClass, should I open fields for inherited properties, or only one field to unique property which is not inherited ?

If I only should open field for unique property, then, where will the inherited properties on SecondClass be stored ?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 30, 2007 2:37 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
You can design your inheritance like you would normally, only placing the field that extends FirstClass in the SecondClass object.
When you use the Subclass strategy, the primary key will be the same between the two tables so the other data (from FirstClass) will reside in the FirstClass table

Take care,
Mike

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 30, 2007 9:57 am 
Newbie

Joined: Sun Jul 29, 2007 6:21 am
Posts: 3
Thanks! Well I decided to choose the first method, it seems more suitable for me.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 30, 2007 12:34 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
Glad to help...good luck
Mike

_________________
If this helped...please remember to rate it!


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

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.