-->
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.  [ 2 posts ] 
Author Message
 Post subject: Joined SubClass with a different identities.
PostPosted: Wed Aug 12, 2009 2:29 am 
Newbie

Joined: Wed Aug 12, 2009 2:20 am
Posts: 1
Hi,

Is there any way where we can have joined subclass with a different primary key than the super class.

Eg:

Person Table
===========

Id -PK (ORACLE SEQ)
fname - VARCHAR
lname - VARCHAR

Customer Table
===========
Id - PK (ORACLE_SEQ)
prop1 - VARCHAR
prop2 - VARCHAR
personId - FK - Person(Id)


Having this kind of table structure, if we have to go with java classes like Person, and Customer extending Person the mapping strategy to be used is joined-subclass I suppose. But the subclass Customer's table has a different primary key to that of Person' table. Joined subclass doesn't seem to have any Id element to handle these kind of cases.

Is there any way to get around with this problem ?? We cant change the table structure since its a legacy system.

Any help is appreciated.

Cheers!!
Katta


Top
 Profile  
 
 Post subject: Re: Joined SubClass with a different identities.
PostPosted: Thu Aug 13, 2009 6:24 pm 
Newbie

Joined: Mon Sep 11, 2006 1:27 am
Posts: 2
I am facing similar problem. I even tried using <join> tag provided in the hibernate mapping to join two tables and map it to one class, but this also won't work if primary keys are different in base class table and sub-class table.


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