Hi,
I am having difficulties understanding mapping parent/child relationships using embedded value type objects, i'll try to explain my situation:
Parent
parent_id -> PK
.
.
.
Child
parent_id -> FK to Parent
covid
.
.
.
In Child parent_id and covid is a composite PK, the child table has more columns, some of which are nullable. There is a one-to-many relationship between parent and child. A parent cannot have more than one child with the same covid. I have been reading the book Java Persistence with Hibernate and it states that to use child as en embedded value type object all columns must be a composite primary key but thats not my case as the composite key is parent_id and covid, also it says I could add a surrogate key to the table to avoid this but I cannot modify the schema. Is there a way I can create this relationship without making child a full entity?
Thanks,
Angel
|