-->
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: Foreign key part of composite primary key?
PostPosted: Thu Apr 03, 2008 3:52 am 
Newbie

Joined: Thu Apr 03, 2008 3:44 am
Posts: 1
Hi all,

i am new in this forum.

I am studying hibernate annotations and would like to undersrand of to map a simple relation between 2 tables.

The table are :

Table User (

username PK;
..
..
..
)

Table Session (

operator PK
username_fk FK PK
...
...
)

The realtion is User -> Session (OneToMany so that a user can have many sessions)

In the second table i have a composite primary key made up of a Foreign key member;

Now i did not find a way to map it with hibernate annotations.

I use an Embeddable class to map the composite primary key.

Can someone help me with a little functioning sample code?


Thanks in advance.


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.