[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: Re[eclipselink-users] ferencing part of a Composite PK
|
Surely if A.col1 is unique then it is the natural PK of A and A.col2 might
be interesting but not necessary to the primary key. Something like the
following might work for you.
public class A {
@Id
private String col1;
private String col2;
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private B b;
...
Public class B {
@Id
Private String col1;
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private A a;
...
Might do
-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx
[mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of njr
Sent: Thursday, June 10, 2010 12:01 AM
To: eclipselink-users@xxxxxxxxxxx
Subject: Re[eclipselink-users] ferencing part of a Composite PK
I have Table A (col1, col2, col3).
In Table A has a composite PK of (col1, col2)
In this col1 alone is a unique also.
I have another Table B (col1, col4, col5)
In table B, col1 is a PK.
col1 is also FK referencing col1 of table A.
Is it feasible to map such a kind of relation in Eclipselink?
If yes, can you please suggest on how to do that?
What should we be using in the join columns?
--
View this message in context:
http://old.nabble.com/Referencing-part-of-a-Composite-PK-tp28839492p28839492
.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users