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 ...
随机推荐
- Django之反向生成url
首先新建一个项目test_url,项目包含一个名为app01的应用 在urls.py文件中生成如下内容 from django.conf.urls import url from django.sho ...
- 架设rsync服务器同步数据
什么是rsync rsync 是一个快速增量文件传输工具,它可以用于在同一主机备份内部的备分,我们还可以把它作为不同主机网络备份工具之用.本文主要讲述的是如何自架rsync服 务器,以实现文件传输.备 ...
- How to fix “HTTP Status Code 505 – HTTP Version Not Supported” error?--转
http://dotnetstock.com/technical/http-status-code-505-http-version-not-supported/ The reason for the ...
- elasticsearch的percolator操作
es的普通查询是通过某些条件来查询满足的文档,percolator则不同,先是注册一些条件,然后查询一条文档是否满足其中的某些条件. es的percolator特性在数据分类.数据路由.事件监控和预警 ...
- Java基础之Throwable,文件加载
Java中的异常与错误都继承自Throwable,Exception又分为运行时异常(RuntimeException)和编译时异常. 运行时异常是程序的逻辑不够严谨或者特定条件下程序出现了错误,例如 ...
- BZOJ 3456: 城市规划 [多项式求逆元 组合数学 | 生成函数 多项式求ln]
3456: 城市规划 题意:n个点组成的无向连通图个数 以前做过,今天复习一下 令\(f[n]\)为n个点的无向连通图个数 n个点的完全图个数为\(2^{\binom{n}{2}}\) 和Bell数的 ...
- BZOJ 1444: [Jsoi2009]有趣的游戏 [AC自动机 高斯消元]
1444: [Jsoi2009]有趣的游戏 题意:每种字母出现概率\(p_i\),有一些长度len的字符串,求他们出现的概率 套路DP的话,\(f[i][j]\) i个字符走到节点j的概率,建出转移矩 ...
- BZOJ 2024: [SHOI2009] 舞会 [容斥原理 高精度]
题意:和上题基本一样,求至少k对a>b的方案数.不取模!!! 做k+1遍容斥就行了 高精度超强!!!几乎把所有的都用上了 然后,注意有负数,所以容斥的时候正负分别保存然后再一减就行了 这是我省选 ...
- 记录:mac的浏览器访问任何域名、网址都跳转到本地127.0.0.1或固定网址
新年上班第一天,刚开机就遇到了个小坑,问题是这样,打开浏览器,输入任何网址都跳转到本地的一个项目,该项目在本地Apache配置下,监听的端口是8888,本机访问的形式是127.0.0.1:8888. ...
- 获取网站证书的两种方法(wireshark or firefox nightly)
一.使用Wireshark 截取数据包的方式 1. wireshark软件需要使用管理员权限运行,开始捕获后,按下ctrl + f,查找证书所在分组,从source 和destination 栏可以看 ...