-->
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.  [ 3 posts ] 
Author Message
 Post subject: inheritance discrminator property from a foreign table
PostPosted: Tue Sep 16, 2008 10:16 pm 
Newbie

Joined: Tue Sep 16, 2008 10:06 pm
Posts: 2
my table structure


table
person
columns
name
type (FK person_types)


assuming the PK etc are all there


type column is a foreign key from person_types table

person_types
id
alias
description


data for person_types
1 , customer,A customer
2 ,employee , An employer


data for person
mi, 1
mi1, 2


can I have hibernate inheritance for this table structure ? if so please help how can I ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 18, 2008 12:39 pm 
Newbie

Joined: Tue Sep 16, 2008 10:06 pm
Posts: 2
Please tell me if it is possible or not please let me know Please hibernate gurus, please help me.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 18, 2008 1:20 pm 
Beginner
Beginner

Joined: Wed Sep 21, 2005 11:52 am
Posts: 43
Let me get this straight. You have a table called PERSON which has the columns: NAME, TYPE and a table called PERSON_TYPE which has the columns: ID, ALIAS, DESCRIPTION.

I assume there are corresponding objects. You should post the mapping files for those! In any case, I think you are saying that each Person has a reference to PersonType through the column TYPE which is a foreign key to the primary key in PERSON_TYPE.

If this is all true there is no inheritance and no need for a discriminator. A discriminator is used only if you have more than one class in a class hierarchy mapped to the same table.

If you haven't written your mapping files then post the java code for the two classes.

Hope this helps. Don't forget to rate if this is useful.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.