I have a one-to-one relationship, but the relation is defined by unique keys rather than primary keys. The DB tables are:
Code:
create table CG_USER
(
USER_ID NUMBER not null, (primary key, Hibernate generated)
ORACLE_ID VARCHAR2(30) not null (unique)
)
create table EMPLOYEE (read only, not under my control)
(
EMPLID VARCHAR2(30) not null, (primary key)
UNIQUE_ID VARCHAR2(30) not null (unique)
)
The classes are:
CgUser - id, oracleId, employee
Employee - emplid, uniqueId
The one-to-one relation is defined by ORACLE_ID and UNIQUE_ID. The Employee property of CgUser may be null.
Can this relation be mapped by Hibernate? If not, any suggestions as to how best to handle it? Thanks.