1、错误信息
Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Multiple representations of the same entity
2、错误原因

因为试图给 某一个new 的Transient对象 的某一个属性赋一个 已经Persistent 对象或者Detached 对象值。导致最后save 或者merge 这个Transient对象报这个错误。

3、解决方案

这应该算是Hibernate 自身的一个bug ,已经在4.2.15版本中解决

1、更新hibernate版本到4.2.15 以上

2、在hibernate的配置文件中添加如下属性:

<property name="hibernate.event.merge.entity_copy_observer">allow</property>

如果使用的Spring 管理hibernate, 在你的spring的数据源中配置

<prop key="hibernate.event.merge.entity_copy_observer">allow</prop>

具体参考:http://thinerzq.me/2016/02/01/Multiple-representations-of-the-same-entity-are-being-merged%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/

  

Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Multiple representations of the same entity解决方法的更多相关文章

  1. HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram

    HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGram ...

  2. org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: Unknown column 'viewpoint' in 'field list'

    问题描述:当我在model中添加了一下代码以后数据库报错: 添加的代码为: private Viewpoint viewpoint; public Viewpoint getViewpoint() { ...

  3. org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jboss.resteasy.plug

    之前做的项目是resteasy的上传,代码没有问题,断点都不进来呢. 我以为可以直接移植到SpringMVC,但是SpringMVC不支持MultipartFormDataInput , 用Multi ...

  4. HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement

    1.什么操作出现:当我在项目中添加产品或者修改时,浏览器出现HTTP Status 500 - Request processing failed; nested exception is org.h ...

  5. [springMVC - 1A] - Request processing failed; nested exception is org.apache.ibatis.builder.IncompleteElementException

    一月 14, 2016 1:30:07 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for ...

  6. Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid b

    Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid b ...

  7. Spring Cloud ZooKeeper集成Feign的坑2,服务调用了一次后第二次调用就变成了500,错误:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.n

    错误如下: 2017-09-19 15:05:24.659 INFO 9986 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refre ...

  8. HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException

    HTTP Status 500 - Request processing failed; nested exception is java.lang.NullPointerException type ...

  9. HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: Control character in cookie value or attribute.

    HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: ...

随机推荐

  1. 重新想象 Windows 8 Store Apps (2) - 控件之按钮控件: Button, HyperlinkButton, RepeatButton, ToggleButton, RadioButton, CheckBox, ToggleSwitch

    原文:重新想象 Windows 8 Store Apps (2) - 控件之按钮控件: Button, HyperlinkButton, RepeatButton, ToggleButton, Rad ...

  2. C++习题 复数类--重载运算符2+

    Description 定义一个复数类Complex,重载运算符"+",使之能用于复数的加法运算.参加运算的两个运算量可以都是类对象,也可以其中有一个是整数,顺序任意.例如,c1+ ...

  3. Java中动态代理技术生成的类与原始类的区别

    用动态代理的时候,对它新生成的类长什么样子感到好奇.有幸通过一些资料消除了心里的疑惑. 平时工作使用的Spring框架里面有一个AOP(面向切面)的机制,只知道它是把类重新生成了一遍,在切面上加上了后 ...

  4. Hibernate 映射字段问题[ImprovedNamingStrategy]

    Hibernate 使用JPA 对于映射有3种规则能够配置:DefaultNamingStrategy,ImprovedNamingStrategy,EJB3NamingStrategy 这里仅仅说I ...

  5. cocos2dx-2.x CCFileUtils文件管理分析(2)

    于1于,我只是对整体结构进行了分析,然后,2于,我会在一些我们经常使用的分析功能. //获取给定文件名称的全路径 //以下这非常长一段凝视.通过举样例,像我们说明cocos2dx获取文件全路径的规则. ...

  6. CSA 第五届研讨会 想象

    参加第五届CSA云安全联盟研讨会. 人们太.所以,我们没有找到座位.立一个很长的时间.为了弥补没有时间坐在办公室.一个补回来.首先为大家介绍的信贷云,事实上独立: 信-使用-云 1. 信-使用-云 什 ...

  7. akka.net与微软分布式框架Orleans

    微软分布式框架Orleans开源了 开源地址: https://github.com/dotnet/orleans 昨天编译了一下,这个最新的Orleans安装程序(用github源码编译的) 下载地 ...

  8. C# HttpClient Cookie验证解决方法

    自实现的cookie 验证,远程取值的例子 以下代码配合HttpClient使用可以实现跨域(cookie的读写) //验证 复制代码 代码如下: HttpClient httpClient = ne ...

  9. ASP.NET自定义控件组件开发 第四章 组合控件开发CompositeControl 后篇 --事件冒泡

    原文:ASP.NET自定义控件组件开发 第四章 组合控件开发CompositeControl 后篇 --事件冒泡 CompositeControl  后篇 --事件冒泡 系列文章链接: ASP.NET ...

  10. 在SQL2008中,如何让id自动生成并自动递增?如何让时间默认生成?

    id自动递增:    如果是用语句操作,这样定义:ID INT IDENTITY,如果是要生成一对数字,这样定义:ID INT IDENTITY(1,1)    如果要在SQL Server的表中设置 ...