【问题标题】:How to add extra columns in many to many join table in hbm.xml : hibernate? [duplicate]如何在 hbm.xml 中的多对多连接表中添加额外的列:休眠? [复制]
【发布时间】:2012-10-17 12:44:05
【问题描述】:

可能重复:
Can add extra field(s) to @ManyToMany Hibernate extra table?

这是我的问题,有没有办法在休眠中使用 hbm.xml 文件在多对多连接表中添加额外的列。就像:

Create table employee(
emp_id int primary key,
emp_name varchar(50)
);

Create table address(
address_id int primary key,
address varchar(500)
);

Create table employee_address(
emp_id int,
address_id int,
/********** this is an extra column **********/
no_of_letters_sent int,

foreign key(emp_id) references employee(emp_id),
foreign key(address_id) references address(address_id)
);

如何为第三张表制作hbm.xml文件?

【问题讨论】:

    标签: hibernate many-to-many rdbms hbmxml


    【解决方案1】:

    我认为您不能添加额外的列并保持多对多 rel。 你必须切换到多对一的rels。

    查看这里的讨论:

    Can add extra field(s) to @ManyToMany Hibernate extra table?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-21
      • 2021-08-18
      • 2014-02-14
      • 1970-01-01
      • 2011-03-26
      • 2012-05-12
      • 2016-05-11
      • 2013-11-02
      相关资源
      最近更新 更多