lundi 23 mai 2016

Two entities having one to many relationship with another entity

I have three enttites A,B and C. The relation is as follows:

A is One To many with C
B is One to many with C

If I have only one of the above, I use to keep a "id" of A/B in C as a foreign key. But in this case I am not getting how to do it.

An entry in C either belongs to A or B not both.

I am using Hibernate as ORM, and MySQL as database. Please suggest.

Aucun commentaire:

Enregistrer un commentaire