[jboss-user] [EJB 3.0] - Design Decision (One-to-Many)

Andre1001 do-not-reply at jboss.com
Mon Sep 18 20:12:15 EDT 2006


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. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972450#3972450

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972450



More information about the jboss-user mailing list