0

I've got the 3 following tables:

    Table1:
    keyA; keyB; keyC; (primary key is A+B+C)

    Table2:
    keyA; keyC; (primary key is A+C)

    Table3:
    keyA; keyB; (primary key is A+B)

With hibernate xml mapping I want for my Table1 to be linked to both Table2 and Table3 using these keys. Can I do that?

2 Answers2

0

simply describe a link many to many between the table 2 and 3 by the jointable table 1. cf this example: enter link description here

0

Well in your first Table Table1 you have (primary key is A+B+C), and you are asking:

With hibernate xml mapping I want for my Table1 to be linked to both Table2 and Table3 using these keys. Can I do that?

Yes, you can do that, but your two other tables Table2 and Table3 must have all the keys/columns that represent the Primary key of Table1, so they must contain the three columns keyA, keyB and keyC along with a OneToMany mapping between Table1 and both Table2 and Table3.

cнŝdk
  • 31,391
  • 7
  • 56
  • 78