Caused by:org.hibernate.DuplicateMappingException:Duplicate class/entity/ mapping
1、错误描述
java.lang.ExceptionInInitializerError
Caused by:org.hibernate.InvalidMappingException:Could not parse mapping document from resource com/you/model/Monkey.hbm.xml
Caused by:org.hibernate.DuplicateMappingException:Duplicate class/entity/ mapping com.you.model.Monkey
2、错误原因
Configuration config = new Configuration();
config.addClass(Monkey.class);
ServiceRegistry serviceRegistry = new ServiceRegistry().applySettings(config.getProperties().buildServiceRegistry();
sessionFactory = config.buildSessionFactory(serviceRegistry);
3、解决办法
由于配置文件已经添加到Monkey.class,而config.addClass(Monkey.class);又重复添加,故需要将此注释掉
Configuration config = new Configuration();
//config.addClass(Monkey.class);
ServiceRegistry serviceRegistry = new ServiceRegistry().applySettings(config.getProperties().buildServiceRegistry();
sessionFactory = config.buildSessionFactory(serviceRegistry);
Caused by:org.hibernate.DuplicateMappingException:Duplicate class/entity/ mapping的更多相关文章
- Atitit.解决org.hibernate.DuplicateMappingException: Duplicate class/entity mapping
Atitit.解决org.hibernate.DuplicateMappingException: Duplicate class/entity mapping 1. 排除流程::: @Depreca ...
- Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource Caused by: org.hibernate.DuplicateMappingException: duplicate import: Person refers to both cn.itcast.
此错误是说有两个相同的名字的配置文件,所以不知道查找哪个.解决方法就是把不需要的那个配置文件删除. 删除mapping中不需要的那个xml文件即可
- hibernate3 Duplicate class/entity mapping(异常)
hibernate3 Duplicate class/entity mapping(异常) 代码: Configuration config = new Configuration().ad ...
- 错误解决Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: pers.zhb.domain.Student column: classno (should be mapped with insert="false" update="false")
1.在学习hibernate的一对多多对一关系的时候,出现了一下错误: 2.错误原因: 这是因为在配置student.hbm.xml的配置文件的时候出现了将两个属性映射到同一个字段: <?xml ...
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/domain/book.hbm.xml 联网跑一跑
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/domain/boo ...
- 报错Caused by: org.hibernate.AnnotationException: No identifier specified for entity:
Caused by: org.hibernate.AnnotationException: No identifier specified for entity:. 原因: 1.没有给实体类ID 解决 ...
- Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.qingmu.seller.entity.OrderMaster
org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before ...
- 分享知识-快乐自己:Caused by: org.hibernate.tool.schema.extract.spi.SchemaExtractionException: More than one table found in namespace (, ) : Dept (XXX)
在命名空间(,)中找到多个表 - SchemaExtractionException? 问题: 尝试在Java应用程序中使用Hibernate将一些值保存到表中时,我一直面临着这个奇怪的异常. 但是, ...
- Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
docs.jboss.org文档示例代码:(http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/) sta ...
随机推荐
- ImageMagick命令行工具
[ convert | identify | mogrify | composite | montage | compare | display | animate | import |conjure ...
- python os模块实用函数
os.sep可以取代操作系统特定的路径分隔符.windows下为 “\\” os.name字符串指示你正在使用的平台.比如对于Windows,它是'nt',而对于Linux/Unix用户,它是'pos ...
- 快速傅里叶变换 & 快速数论变换
快速傅里叶变换 & 快速数论变换 [update 3.29.2017] 前言 2月10日初学,记得那时好像是正月十五放假那一天 当时写了手写版的笔记 过去近50天差不多忘光了,于是复习一下,具 ...
- 夏令营讲课内容整理 Day 6 Part 3.
第三部分主要讲的是倍增思想及其应用. 在Day3的整理中,我简要提到了倍增思想,我们来回顾一下. 倍增是根据已经得到的信息,将考虑的范围扩大一倍,从而加速操作的一种思想,它在变化规则相同的情况下,加速 ...
- JDBC【事务、元数据、改造JDBC工具类】
1.事务 一个SESSION所进行的所有更新操作要么一起成功,要么一起失败 举个例子:A向B转账,转账这个流程中如果出现问题,事务可以让数据恢复成原来一样[A账户的钱没变,B账户的钱也没变]. 事例说 ...
- zookeeper 内部机制学习
zookeeper 内部机制学习 1. zk的设计目标 最终一致性:client不论连接到那个Server,展示给它的都是同一个视图. 可靠性:具有简单.健壮.良好的性能.如果消息m被到一台服务器接收 ...
- Mock拦截ajax请求
//mock拦截ajax请求 ,生成随机数据Mock.mock('./servlet/UserServlet?method=getUser',{ 'list|1-5':[{ 'username':'@ ...
- Python自动化--语言基础8--接口请求及封装
基于http协议,最常用的是GET和POST两种方法. 接口文档需要包含哪些信息: 接口名称接口功能接口地址支持格式 json/xml请求方式请求示例请求参数(是否必填.数据类型.传递参数格式)返回参 ...
- WinXP系统下Opencms的安装与配置
1.WinXP系统下安装opencms (1)mysql已安装5.1.40 cmd命令行:mysql -uroot -proot (2)OpenCMS在安装时要求MySQL系统变量“max_al ...
- mvc get image 500
mvc中get图片时报500错误 很奇怪,突然变500错误了,一番查找之后发现原来是因为mimeType重复定义的原因,吐血.. http://stackoverflow.com/questions/ ...