-->
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.  [ 6 posts ] 
Author Message
 Post subject: Inheritance hierarchy in Primary Keys and Association issue!
PostPosted: Wed Oct 10, 2007 2:34 pm 
Newbie

Joined: Wed Oct 10, 2007 12:26 pm
Posts: 5
Location: Santa Clara
Hi,
I have the following scenario:
Entity Class B & C extends A
Entity Class E & F estends D
Embedable Class EPK & FPK extends GPK (these are composite primary keys)

Class E uses EPK & class F uses FPK.
Class A has 1..2 association with D (meaning either 2E's or 2F's or E & F)

1..2
A<>-------------------- D GPk
/\ /\ /\
B C E F EPK FPK

As such I have added 2 @OneToOne association in class A instead of @OneToMany due to other reasons.

The issue is Class B or Class C could have 2 E's or 2F's or E & F, which means that the join column for Entity B & C is not sure? Can anyone please help is solving this issue?
Thanks in advance
Kuga


Top
 Profile  
 
 Post subject: Re: Inheritance hierarchy in Primary Keys and Association is
PostPosted: Thu Oct 11, 2007 8:27 am 
Beginner
Beginner

Joined: Mon Aug 27, 2007 8:10 am
Posts: 37
kugaprakash wrote:
Hi,
I have the following scenario:
Entity Class B & C extends A
Entity Class E & F estends D
Embedable Class EPK & FPK extends GPK (these are composite primary keys)


There is a bug in Hibernate which may cause these errors.
Please take a look at this post

http://forum.hibernate.org/viewtopic.php?t=978915


Top
 Profile  
 
 Post subject: Re: Inheritance hierarchy in Primary Keys and Association is
PostPosted: Thu Oct 11, 2007 8:43 am 
Beginner
Beginner

Joined: Mon Aug 27, 2007 8:10 am
Posts: 37
kugaprakash wrote:
Hi,
I have the following scenario:
Entity Class B & C extends A
Entity Class E & F estends D
Embedable Class EPK & FPK extends GPK (these are composite primary keys)


There is a bug in Hibernate which may cause these errors.
Please take a look at this post

http://forum.hibernate.org/viewtopic.php?t=978915


Top
 Profile  
 
 Post subject: Re: Inheritance hierarchy in Primary Keys and Association is
PostPosted: Thu Oct 11, 2007 12:27 pm 
Newbie

Joined: Wed Oct 10, 2007 12:26 pm
Posts: 5
Location: Santa Clara
hutorny wrote:
kugaprakash wrote:
Hi,
I have the following scenario:
Entity Class B & C extends A
Entity Class E & F estends D
Embedable Class EPK & FPK extends GPK (these are composite primary keys)


There is a bug in Hibernate which may cause these errors.
Please take a look at this post

http://forum.hibernate.org/viewtopic.php?t=978915



Hi,
Greatly appreciate your reply!
I am quite far from deploying....
I am still working on getting my POJO's completed. My issue is that I am unable to get associations for such multiple association combinations. Can you please help me figure out a way for that.
Also please take a look at the last para for more information.
thanks
Kuga


Top
 Profile  
 
 Post subject: Re: Inheritance hierarchy in Primary Keys and Association is
PostPosted: Thu Oct 11, 2007 12:27 pm 
Newbie

Joined: Wed Oct 10, 2007 12:26 pm
Posts: 5
Location: Santa Clara
hutorny wrote:
kugaprakash wrote:
Hi,
I have the following scenario:
Entity Class B & C extends A
Entity Class E & F estends D
Embedable Class EPK & FPK extends GPK (these are composite primary keys)


There is a bug in Hibernate which may cause these errors.
Please take a look at this post

http://forum.hibernate.org/viewtopic.php?t=978915



Hi,
Greatly appreciate your reply!
I am quite far from deploying....
I am still working on getting my POJO's completed. My issue is that I am unable to get associations for such multiple association combinations. Can you please help me figure out a way for that.
Also please take a look at the last para for more information.
thanks
Kuga


Top
 Profile  
 
 Post subject: Re: Inheritance hierarchy in Primary Keys and Association is
PostPosted: Fri Oct 12, 2007 4:20 am 
Beginner
Beginner

Joined: Mon Aug 27, 2007 8:10 am
Posts: 37
kugaprakash wrote:
Hi,
I have the following scenario:
Entity Class B & C extends A
Entity Class E & F estends D
Embedable Class EPK & FPK extends GPK (these are composite primary keys)

Class E uses EPK & class F uses FPK.
Class A has 1..2 association with D (meaning either 2E's or 2F's or E & F)

Code:
                                            1..2   
      A<>--------------------   D   GPk
      /\      /\    /\
                   B  C                  E  F           EPK FPK

As such I have added 2 @OneToOne association in class A instead of @OneToMany due to other reasons.

The issue is Class B or Class C could have 2 E's or 2F's or E & F, which means that the join column for Entity B & C is not sure? Can anyone please help is solving this issue?
Thanks in advance
Kuga


Can you provide more details on EPK and FKP? Do they have different set of fields? If so, relations B->E and C->F use different foreing key.
I doubt this kind of inheritance can be acheived in a relatinal DB.
Try to remodel, and if posiible get rid of compisite keys.


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