0 Replies Latest reply on Sep 18, 2006 8:12 PM by Andre Fernando Salvati

    Design Decision (One-to-Many)

    Andre Fernando Salvati Novice

      Hi,

      Please, tell me if I'm thinking the right way!!

      I have a PRODUCT, which has a relationship with INVENTORY in many-to-many mode. This relationship has also several attributes, so I must create a intermediary table (PRODUCT_INVENTORY). I'm in doubt among 3 solutions:

      1 - Create a PRODUCT_INVENTORY with a composite key (idProduct + idInventory) using @IdClass.

      2 - Create a PRODUCT_INVENTORY with a composite key (idProduct + idInventory) using @Embeddable.

      3 - Create a PRODUCT_INVENTORY with a auto-generated id plus to foreign keys (idProduct and idInventory).

      Which one could be the best? Do you have any references about this subject?

      Thanks.