hibernate modeling relationships managed through an intermediate table

Posted by shikarishambu on Stack Overflow See other posts from Stack Overflow or by shikarishambu
Published on 2010-05-25T20:48:06Z Indexed on 2010/05/25 20:51 UTC
Read the original article Hit count: 226

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate