在thrid表中休眠多对多设置主/外键

时间:2017-04-21 06:28:11

标签: java hibernate many-to-many hibernate-mapping hbmxml

我有3个java类,两个entites,第三个是它们之间的关系。我想在hbm.xml中映射它们,但我不知道如何,我在互联网上找不到任何示例

testCompile 'junit:junit:4.12’

如何在xml中将此映射到此第三类“OrderProduct”仅将订单和产品存储为主键和外键。

感谢您的建议

1 个答案:

答案 0 :(得分:0)

不需要OrderProduct实体。您可以在hbm本身中定义映射。请参阅以下链接以了解其完成情况。

https://www.mkyong.com/hibernate/hibernate-many-to-many-relationship-example/