Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] @SecondaryTable in a Source Entity with a Compound 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


Back to the top