0
休眠拋出錯誤:無法找到邏輯名稱列:產品
org.hibernate.MappingException:
Unable to find column with logical name: product in
org.hibernate.mapping.Table(product_part)
and its related supertables and secondary tables
實體類
@Entity
@Table(name = "product_part")
public class ProductPart implements Serializable {
@Id
@GeneratedValue
@Column(name = "id")
private int id;
@ManyToOne
@javax.persistence.JoinColumn(name = "product", referencedColumnName = "product", nullable = false)
private ProductPart productByProduct;
@ManyToOne
@javax.persistence.JoinColumn(name = "part", referencedColumnName = "part", nullable = false)
private Part partByPart;
}
MySQL表
CREATE TABLE `product_part` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product` int(11) NOT NULL,
`part` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_product` (`product`),
KEY `fk_part` (`part`),
CONSTRAINT `fk_product` FOREIGN KEY (`product`) REFERENCES `product` (`product`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_part` FOREIGN KEY (`part`) REFERENCES `part` (`part`) ON DELETE NO ACTION ON UPDATE NO ACTION
)
問題是什麼?如何解決它?
UPDATE:
鏈接表的外鍵:
CREATE TABLE `part` (
`part` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
PRIMARY KEY (`part`)
)
和
CREATE TABLE `product` (
`product` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) NOT NULL,
PRIMARY KEY (`product`)
)
通過更換'私人ProductPart productByProduct解決;'和'私人產品的產品;' – 2014-09-18 18:50:03