解决方案/原因:
  一个pojo(JavaBean)中不能有两个属性同时映射到一个数据库字段上  

  即使是一个属性的两个getter方法也不行

%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Repeated column in mapping for entity: com.entity.AffairItem column: ai_comment (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:830)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:848)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:870)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:605)
at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:464)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:711)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:727)
at com.util.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:50)
at com.test.SysTest.saveUser(SysTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:539)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:761)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:461)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:207)
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Repeated column in mapping for entity: com.entity.AffairItem column: ai_comment (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:830)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:848)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:870)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:605)
at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:464)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:711)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:727)
at com.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:89)
at com.util.HibernateSessionFactory.getSession(HibernateSessionFactory.java:72)
at com.test.SysTest.saveUser(SysTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:539)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:761)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:461)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:207)

  

参考文献:

  【org.hibernate.MappingException: Repeated column in mapping for entity】http://blog.csdn.net/rchm8519/article/details/30284515

Java EE之Hibernate异常总结org.hibernate.MappingException: Repeated column in mapping for entity:的更多相关文章

  1. 错误解决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 ...

  2. Hibernate中的"Repeated column in mapping for entity"异常

    转:http://lijiejava.iteye.com/blog/786535 一对多双向关联(类Item与类Bid): Item类: public class Item { private int ...

  3. 由异常:Repeated column in mapping for entity/should be mapped with insert="false" update="false 引发对jpa关联的思考

    由异常:Repeated column in mapping for entity/should be mapped with insert="false" update=&quo ...

  4. 玩转JPA(一)---异常:Repeated column in mapping for entity/should be mapped with insert="false" update="fal

    最近用JPA遇到这样一个问题:Repeated column in mapping for entity: com.ketayao.security.entity.main.User column: ...

  5. 玩转JPA(一)---异常:Repeated column in mapping for entity/should be mapped with insert=&quot;false&quot; update=&quot;fal

    近期用JPA遇到这样一个问题:Repeated column in mapping for entity: com.ketayao.security.entity.main.User column: ...

  6. hibernate异常:org.hibernate.exception.GenericJDBCException

    异常:org.hibernate.exception.GenericJDBCException 提示:Cannot open connection 提示:不能打开链接 一般这个异常是由 java.sq ...

  7. hibernate异常:org.hibernate.MappingException

    这个是映射文件配置错误 异常:org.hibernate.MappingException 提示:Could not determine type for: java.lang,String, at ...

  8. hibernate异常:org.hibernate.NonUniqueObjectException

    异常:org.hibernate.NonUniqueObjectException 提示:a different object with the same identifier value was a ...

  9. Java EE 之 Hibernate异常解决:org.hibernate.exception.SQLGrammarException: could not execute statement

    本质原因:配置的Java Bean,由Hibernate自动产生的SQL语句中有语法错误 原因如下: 情况1.存在字段名/表名与数据库关键字冲突 情况2.MySQL5.0以后与MySQL5.0以前事务 ...

随机推荐

  1. Dubbo x Cloud Native 服务架构长文总结(很全)

    Dubbo x Cloud Native 服务架构长文总结(很全) mercyblitz SpringForAll社区 3天前 分享简介 Cloud Native 应用架构随着云技术的发展受到业界特别 ...

  2. ftp sun jdk自带

    package com.italktv.colnv.stat.util; import java.io.File; import java.io.FileInputStream; import jav ...

  3. 【CF1141G】Privatization of Roads in Treeland

    题目大意:给定一个 N 个点的无根树,现给这个树进行染色.定义一个节点是坏点,若满足与该节点相连的至少两条边是相同的颜色,求至多有 k 个坏点的情况下最少需要几种颜色才能进行合法染色. 题解:考虑一个 ...

  4. [luogu3388][割点]

    题目链接 思路 真板子题.割点是指在一个无向图中,删去之后图将不再连通的点.可以用tarjan算法求.根据割点有两种情况,一种是根,一种是非根.如果不是根的就去判断在tarjan的时候当前节点所能到的 ...

  5. 如何使用Senparc.Weixin SDK 底层的Redis缓存并设置过期时间

    最近在微信第三方平台项目开发中,有一个需求,所有绑定的公众号的回复规则按照主公众号的关键词配置来处理,我的处理思路是获取主公众号配置的关键词回复规则,缓存10分钟,由于需要使用Redis缓存来存储一些 ...

  6. POJ 3352 Road Construction ; POJ 3177 Redundant Paths (双联通)

    这两题好像是一样的,就是3177要去掉重边. 但是为什么要去重边呢??????我认为如果有重边的话,应该也要考虑在内才是. 这两题我用了求割边,在去掉割边,用DFS缩点. 有大神说用Tarjan,不过 ...

  7. SSH整合redis和MongoDB错误笔记

    由于毕设中做的是图片搜索网站,选择前端框用SSH,因为之间接触过SSH框架,略有了解,但没有深究,现在在整合redis和mongodb的过程中遇到很多错误,也是十分痛苦,只能通过百度和一步步尝试着解决 ...

  8. Weblogic启动服务时候提示:Authentication for user weblogic denied

    一.问题描述: 在Linux系统上对weblogic10.3.6搭建完成后,启动控制台没问题,但是新建的服务怎么都起不来,而且在服务的目录下也有了认证文件boot.properties文件,也确定用户 ...

  9. Oracle 去重并显示所有列数据

    一.原始数据(默认会生成一个 rownum 的序列,如下图的第一列) select t.* from ZD_DIC t where t.zdlx = '人员类型' 二.先分组,再给组内的内容进行排序 ...

  10. 01--STL算法(算法基础)

    一:算法概述 算法部分主要由头文件<algorithm>,<numeric>和<functional>组成. <algorithm>是所有STL头文件中 ...