Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @SecondaryTable in a Source Entity with aCompound Primary Key, Bug?

Hi Tim,

That's a spec limitation, but what you have done, that is, specifying the same pk join column twice is a way past it and should work within EclipseLink. I say 'should' since I don't know your full model etc and your expectations from it.

Cheers,
Guy

----- Original Message ----- From: "Tim Hollosy" <hollosyt@xxxxxxxxx>
To: "EclipseLink User Discussions" <eclipselink-users@xxxxxxxxxxx>
Sent: Thursday, May 22, 2008 8:22 AM
Subject: [eclipselink-users] @SecondaryTable in a Source Entity with aCompound Primary Key, Bug?


Ok this is odd, I have a source entity that has a compound primary
key, I want to do a simple join to bring in another table using the
SecondaryTable annotation, only one of the source eo's pk's is also an
FK.

So If I only specify one @PrimaryKeyJoinColumn I get:

When specifying @PrimaryKeyJoinColumns for an entity that has a
composite primary key, a @PrimaryKeyJoinColumn must be specified for
each primary key join column using the @PrimaryKeyJoinColumns. Both
the name and the referenceColumnName elements must be specified in
each such @PrimaryKeyJoinColumn.

In order to get this to work, I had to specify the same
@PrimaryKeyJoinColumn two times in my @PrimaryKeyJoinColumns array.

I'd guess it's looking for the same number of @PrimaryKeyJoinColumns
as PK's on the source entity, regardless of the fact that not every PK
is an FK.

Is this a bug or something odd in the JPA spec?

Thanks,
Tim
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




Back to the top