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?
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 bothTable2
andTable3
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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.