Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在hbm.xml:hibernate的多对多联接表中添加额外的列?_Hibernate_Many To Many_Rdbms_Hbmxml - Fatal编程技术网

如何在hbm.xml:hibernate的多对多联接表中添加额外的列?

如何在hbm.xml:hibernate的多对多联接表中添加额外的列?,hibernate,many-to-many,rdbms,hbmxml,Hibernate,Many To Many,Rdbms,Hbmxml,可能重复: 这是我的问题,在hibernate中是否有任何方法可以使用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 i

可能重复:

这是我的问题,在hibernate中是否有任何方法可以使用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文件?

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

请参见此处的讨论: