We have an existing schema that applies the following pattern:
Tables A, B, and C all have a one-to-many relationship to Table X. The data model supports this through two columns on Table X: a generic ENTITY_KEY column, and an ENTITY_TYPE column. The ENTITY_KEY is the foreign key value to the parent table (each has surrogate indentity primary keys), and the ENTITY_TYPE qualifies the parent type (ie 'A', 'B', or 'C'). In the Java code, the Classes A, B, and C have a unidirectional relationship to Class X.
I'm having trouble discovering a way to Map these relationships. From the owned entity's perspective, the owner has a composite key, but the owned entity knows nothing about the TYPE qualifier.
Does anyone have any suggestions on how to map such a thing?
Thanks!
|