-->
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: composite foreign key extends composite primary key
PostPosted: Mon Dec 14, 2009 1:55 pm 
Newbie

Joined: Fri Mar 14, 2008 11:04 am
Posts: 3
Hi all,

In the last day i've been trying to solve a problem,

I have an entity called Competition thas has a relationship of oneToMany of Teams
The competition has a relationship of oneToMany competitionAtlete
The Teams entity as a relationship of oneToMany to competitionAtlete, ( and one competitionAtlete as only one team ).

pk in competition
- id_competition
- id_club

pk in competitionAtlete
- id_competition
- id_club
- id_atlete

pk in Teams
- id_competition
- id_club
- name

My issue is in competitionAtlete

the only way i get it to work is using @PrimaryKeyJoinColumns annotation but it creates new atributes to the foreign key instead of using the pk ones
if i use the @JoinColumns i have to use insertable=false, updatable=false in the three elements, and the name attribute is not persisted.

i have find this sentence in the hibernate page: "It is part of the definition of a primary key that it is not only unique, but also constant throughout the life of the row. Hibernate does not, and should not, support changing identifier values."

help is apreciated

Thanks in advance,
Nuno


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.