hibernate modeling relationships managed through an intermediate table
- by shikarishambu
I have a datamodel that has an intermediate table to manage relationships between entities.
For example, tables Person and Organization are related through the Relationship table
Party (table)
- ID
Person (table)
- ID (references Party.ID)
- name
Organization (table)
-ID (references Party.ID)
-name
Relationship (table)
-ID (PK)
-type (references relationshiptype lookup)
-fromID (references Party.ID)
-ToID (references Party.ID)
-fromDate
-ToDate
Type+fromID+ToID+fromDate+ToDate is guaranteed to be unique.
How do I manage this using hibernate?
TIA