A developer is designing a Java Persistence application that is mapped to a set of existing tables.
This set includes table EMPLOYEE, DEPARTMENT, and PROJECT. Tables EMPLOYEE and
DEPARTMENT do NOT define any foreign key constraints to table PROJECT. Table PROJECT
defines foreign key constraints with references to tables EMPLOYEE and DEPARTMENT and an
extra column called COST. The table EMPLOYEE is mapped to an entity Employee and the table
DEPARTMENT to an entity Department.
How can the table PROJECT be mapped so the persistence application can be portable?
A.
Such sets of tables cannot be mapped and keep the application portable.
B.
Map the table PROJECT as a secondary table for either the Employee or Department entity.
C.
Map the table PROJECT to bidirectional many-to-many relationships between the Employee
and Department using a java.util.Map as the type of the field or property.
D.
Map the table PROJECT to an entity Project with a field or property cost mapped to the column
COST and onE. to-many relationships to this entity in the Employee and the Department.