Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: cn.itcast.entity.C

本文主要介绍了在使用Hibernate时遇到的MappingException异常,具体表现为实体类Customer映射文件中出现了重复的列custLevel。分析了错误原因,并提供了两种解决方案:一是删除重复的映射配置,二是为重复字段添加insert="false" update="false"属性。
摘要由CSDN通过智能技术生成

1.异常描述

Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: cn.itcast.entity.Customer column: custLevel (should be mapped with insert=“false” update=“false”)

在这里插入图片描述

2.实体类和映射文件的对应

2-1.实体类

public class Customer {

	private Integer cid;
	private String custName;
	private String custLevel;
	private String custSource;
	private String custLinkman;
	private String custPhone;
	private String custMobile;
	
	//在客户实体类表示所属级别
	private Dict dictCustLevel;
	
	
	public Dict getDictCustLevel() {
		return dictCustLevel;
	}
	public void setDictCustLevel(Dict dictCustLevel) {
		this.dictCustLevel = dictCustLevel;
	}
	private Set<Visit> setCusVisit = new HashSet<Visit>();

	public Set<Visit> getSetCusVisit() {
		return setCusVisit;
	}
//省略部分无关
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值