近期用JPA遇到这样一个问题:Repeated column in mapping for entity: com.ketayao.security.entity.main.User column: org_id (should be mapped with insert="false" update="false")

这个错误是由实体类引起的。我一開始是这样写的:

@Column

private long orgId;

@ManyToOne

@JoinColumn(name="orgId")

private Organization organization;

在这里get和set方法就省略了。

改动为以下这样就好:

@Column(insertable=false,updatable=false)

private long orgId;

@ManyToOne

@JoinColumn(name="orgId")

private Organization organization;

玩转JPA(一)---异常:Repeated column in mapping for entity/should be mapped with insert="false" update="fal的更多相关文章

  1. 玩转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: ...

  2. 由异常: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 ...

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

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

  4. Java EE之Hibernate异常总结org.hibernate.MappingException: Repeated column in mapping for entity:

    解决方案/原因: 一个pojo(JavaBean)中不能有两个属性同时映射到一个数据库字段上 即使是一个属性的两个getter方法也不行 %%%% Error Creating SessionFact ...

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

  6. 【MySQL 线上 BUG 分析】之 多表同字段异常:Column ‘xxx’ in field list is ambiguous

    一.生产出错! 今天早上11点左右,我在工作休息之余,撸了一下猫.突然,工作群响了,老大在里面说:APP出错了! 妈啊,这太吓人了,因为只是说了出错,但是没说错误的信息.所以我赶紧到APP上看看. 这 ...

  7. 错误/异常:org.hibernate.MappingException: Unknown entity: com.shore.entity.Student 的解决方法

    1.错误/异常视图 错误/异常描述:Hibernate配置文件 映射异常,不明实体类Student(org.hibernate.MappingException: Unknown entity: co ...

  8. Struts2异常:HTTP Status 404 - There is no Action mapped for action name addBook.

    HTTP Status 404 - There is no Action mapped for action name addBook. 在地址栏进行访问的时候,出现了这个错误信息,导致出现此异常的原 ...

  9. spring boot jpa没有自动生成表的原因——加上@Entity

    别人的项目弄了好久,竟然是忘记加注解,当然配置文件还是要配置jpa的,pom也要依赖jpa. @Entity jpa: hibernate: ddl-auto: update show-sql: tr ...

随机推荐

  1. Babel的配置和使用

    自从 Babel 由版本5升级到版本6后,在安装和使用方式上与之前大相径庭,于是写了这篇入坑须知,以免被新版本所坑. 坑一:本地安装和全局安装 全局安装只需: $ npm install --glob ...

  2. EGS5在linux系统下安装过程

    转载自52MC论坛 作者:xinruibj 平台:Fedora 13 内核版本为:2.6.33, g77版本为:3.4.6: 用户名为xinrui,下面出现这个文件夹xinrui时,修改为你自己的用户 ...

  3. 20170416郑州市轻工业学院ACM校赛

    这是个星期天,但是,这种非一线城市,重点城市什么的高中,放假从来不按套路出牌,几乎可以说能给你一天是福气.当然,比县里好的多,问在县里上高中的初中同学,放假更是比我们一天里的午休+晚上吃饭时间还要少. ...

  4. [LOJ6277]数列分块入门 1

    题目大意: 给你一个长度为$n(n\leq 50000)$的序列$A$,支持进行以下两种操作: 1.将区间$[l,r]$中所有数加上$c$: 2.询问$A_r$的值.思路: 分块. 对于整块的数据打标 ...

  5. Could not automatically select an Xcode project

    当把CocoaPods生成的workspace移动到上层目录时,需要改下Pods.xcconfig和工程里的一些设置,就通常没什么难度. 当遇到这个问题时: Could not automatical ...

  6. Linux下Shell的复制粘贴快捷键

    [Shift]+[Insert]:复制 [Ctrl]+[Insert]:粘贴

  7. ios中调用WCF

    例子比较简单 记录下思路 1.接口中定义 实体和方法声明 //登录信息        [OperationContract]        [WebInvoke(UriTemplate = " ...

  8. session的作用范围(转)

    session是在服务器端建立的,浏览器访问服务器会有一个jsessionid,浏览器端通过 jsessionid定位服务器端的session,session的创建和销毁由服务器端控制.当浏览器关闭后 ...

  9. 可以使用foreach遍历循环的条件

    大话C#中能使用foreach的集合的实现 转自:http://www.cnblogs.com/tangzhengyue/p/3339936.html   大家都知道foreach的语法: forea ...

  10. spring boot 使用mybatis-generator

    mybatis-generator官网: http://www.mybatis.org/generator/running/runningWithMaven.html 在pom.xml中的 build ...