[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: Re[eclipselink-users] ferencing part of a Composite PK
|
I agree that just making only the col1 the Id would probably be the best
solution.
You can map a OneToOne mapping in EclipseLink using a partial foreign key.
I don't this will work through JPA annotations though, so you will need to
use a DescriptorCustomizer.
See,
http://wiki.eclipse.org/EclipseLink/Examples/JPA/MappingSelectionCriteria
Mark Millman-2 wrote:
>
> 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
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://old.nabble.com/Referencing-part-of-a-Composite-PK-tp28839492p28891867.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.