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 primary key associations
PostPosted: Wed May 11, 2005 3:28 am 
Newbie

Joined: Wed May 11, 2005 3:05 am
Posts: 2
Location: Australia
Hibernate version: 3.03

Hi Guys,

Is it possible to define a composite primary key association? I know that I can do this using a simple key.

I have a class Foo that has a composite primary key of the form:

<composite-id>
<key-property name="id1" ..." />
<key-property name="id2" ..." />
</composite-id>

Foo composes another object called Bar. In the DBMs Bar has a foreign key back to the Foo composite primary key

Class Foo {
long id1;
long id2;

Bar data
}


Class Bar

long id1;
long id2;
...
String detail;

}

I cannot seem to find a way to add the one-to-one associations using the
composite key.

Also is there any way to configure the Bar ID so that it is set to the same value as the Foo primary key on a save?

thanks,

Lara


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.