Hello,
I am using JPA and trying to map a complex class to table mapping.
The simplified version is consider EMP and ADD tables where EMP has an ID primary key and has a foreign key ADD_ID to ADD. I need to map both tables to a single Employee class using JPA (I know I could just define two classes, but I cannot do this in my case).
If I just define EMP using @Table and ADD using @SecondaryTable, this does not work because it assumes ID is in ADD and matches EMP.ID, which it does not. Using @JoinColumn does not work either because I need to join with the foreign key not the primary key of EMP.
I seems that JPA does not support this, is there a Hibernate extension annotation that will allow this?
|