0 Replies Latest reply on Nov 29, 2006 12:32 PM by xmaniac

    Composite primary key from foreign keys

    xmaniac

      I'm unable to figure out how to implement this.

      I have 3 tables in my DB: Team (surrogate pk), Period (surrogate pk) and TeamPeriods (pk composed of both foreign keys).

      I need to create an entity from the third table so I can then query the Team objects and receive a collection of TeamPeriods (and then Periods if needed). I don't want to create a surrogate key and an index for this table.

      I've seen the @Embeddable annotation but I'm still unsure on how to apply it in this case.