-->
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: mapping for Composite Primary Key with a foreign key
PostPosted: Mon Sep 12, 2005 2:02 am 
Newbie

Joined: Mon Sep 12, 2005 1:50 am
Posts: 3
Location: Gurgaon, India
hi all,

I want to know the mapping for a table containing composite primary key,
and one them is also a foreign key
For example:

suppose there are two tables

+-------------------------
PARENT
+-------------------------
parent_id int PRIMARY_KEY,
p1 string,
p2 string,
--------------------------

and

+--------------------------------------------------------------
CHILD
+--------------------------------------------------------------
born_date timestamp PRIMARY_KEY,
parent_id int PRIMARY_KEY,
constraint c1 FOREIGN_KEY parent_id reference PARENT(parent_id),
+--------------------------------------------------------------

can anyone tell me how to define the mapping file for CHILD table.

I will really appreciate the effort.

Thanks in advance

Hibernate version:2.1

_________________
RahulJoshi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 12, 2005 4:14 am 
Beginner
Beginner

Joined: Thu Sep 08, 2005 10:29 am
Posts: 21
See http://www.hibernate.org/hib_docs/refer ... ompositeid


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 13, 2005 6:21 am 
Newbie

Joined: Mon Sep 12, 2005 1:50 am
Posts: 3
Location: Gurgaon, India
marceloverdijk wrote:


there is no way you can define the foreign key constraint in <composite-id>

_________________
RahulJoshi


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.