`
mickey_hou
  • 浏览: 243841 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Illegal attempt to associate a collection with two open sessions

阅读更多
org.springframework.orm.hibernate3.HibernateSystemException: Illegal attempt to associate a collection with two open sessions; nested exception is org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:744)
at com.huawei.cloud.util.baseDAO.impl.BaseDaoImpl.saveOrUpdateObject(BaseDaoImpl.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy78.saveOrUpdateObject(Unknown Source)
at com.huawei.cloud.service.impl.ComputingManagerServiceImpl.update(ComputingManagerServiceImpl.java:251)
at com.huawei.cloud.service.computing.JobTracer.errorClear(JobTracer.java:352)
at com.huawei.cloud.service.computing.JobTracer.run(JobTracer.java:106)
Caused by: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
at org.hibernate.collection.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:432)
at org.hibernate.event.def.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:66)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:124)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:84)
at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:78)
at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:146)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:316)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:112)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522)
at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:747)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
... 17 more



解决方式1:this.getHibernateTemplate().merge(entity)
分享到:
评论

相关推荐

    eclipse常见报错

    4. SSH 架构中 Illegal attempt to associate a collection with two open sessions 问题 。 解决方法:使用 Hibernate 的 merge 方法代替 save、update 等方法。merge 方法可以把对象转变为托管状态的对象,而 ...

    关于C#更新智能大对象更新时的问题及解决方法.doc

    在使用C#与南大通用数据库(GBase)交互时,遇到的一个常见问题是尝试更新Blob或Clob(大型对象)时出现错误:“Illegal attempt to use Text/Byte host variable”。这个问题通常发生在利用CSDK中的ADO.NET驱动进行...

    illegal access to protected memory(解决方案).md

    illegal access to protected memory(解决方案).md

    AES加密出现InvalidKeyException之Illegal key size解决方案

    今日遇到如下错误:java.security.InvalidKeyException: Illegal key size 因为美国法律限制,JAVA默认支持AES 128 Bit 的key, 如果你计划使用 192 Bit 或者 256 Bit key, java complier 会抛出 Illegal key size ...

    VB编程资源大全(英文源码 其它)

    Copy the file with .scr extension to your computers win directory (Windows for 98, Winnt for NT) and check in screens saver settings.<END><br>73,Cls_sample_Collection.zip Implement with Class and ...

    解决java.security.InvalidKeyException: Illegal key size

    在Java编程环境中,有时会遇到一个常见的错误:"java.security.InvalidKeyException: Illegal key size"。这个错误通常是由于Java安全策略的限制导致的,尤其是当你尝试使用超过默认限制的密钥长度(例如,超过128位...

    CRACKING CODES WITH PYTHON An Introduction to Building and Breaking Ciphers

    Chapter 23 that implement part of the RSA cipher would be illegal to export out of the United States. Because messages encrypted with RSA are impossible to hack, the export of encryption software like...

    JSP Simple Examples

    ArrayIndexOutOfBoundException is thrown when we have to indicate that an array has been accessed with an illegal index. printStackTrace in jsp printStackTrace is a method of the Throwable class. By ...

    微信支付接口 java.security.InvalidKeyException: Illegal key size

    对接微信接口中因为jdk8解密长度不够 报错 java.security.InvalidKeyException: Illegal key size 替换路径:(记得备份原有的文件) C:\Program Files\Java\jdk1.8.0_131\jre\lib\security

    Ice License v1.15

    Your application is protected by two keys, one key is inside application it‘s a public key and the second it‘s a private key (that only the owner) which are used in combination to encrypt and ...

    解决illegal Key Size jdk7版本

    在Java开发过程中,有时会遇到“illegal key size”这样的错误,这通常是由于Java加密相关的安全限制所导致的。这个问题在 JDK 7 版本中尤为常见,因为默认配置的Java Cryptography Extension (JCE) 有对密钥长度的...

    java.security.InvalidKeyException: Illegal key size 更换的Jar包

    为了数据代码在传输过程中的安全,很多时候我们都会将要传输的数据进行...然而,在使用256位密钥加解密的时候,如果不进行特殊处理的话,往往会出现这个异常java.security.InvalidKeyException: Illegal key size。

    php错误提示failed to open stream: HTTP request failed!的完美解决方法

    google或者baidu一下,好多这样的问题,解决的方法都是修改php.ini,把allow_url_fopen给启用,改成 allow_url_fopen = On 这样做可以解决某些人的问题,有人说在php.ini中,有这样两个选项:allow_url_fopen =on...

    AES加密时抛出java.security.InvalidKeyException: Illegal key size or default parameter

    当在Java环境中使用AES加密时遇到 `java.security.InvalidKeyException: Illegal key size or default parameter` 这个异常,通常意味着密钥的长度超过了Java安全策略所允许的最大值。具体来说: - **非法密钥大小...

    java.security.InvalidKeyException: Illegal key size 解决方案

    在Java编程中,`java.security.InvalidKeyException: Illegal key size` 是一个常见的错误,通常出现在加密或解密操作中,尤其是涉及到对称加密算法如AES(高级加密标准)时。这个错误表明您试图使用的密钥长度不受...

    [Head.First.JavaScript].Michael.Morrison...

    Like talking to a brick wall... nothing happens 3 But JavaScript talks back 4 Lights, camera, interaction! 6 Use the [removed] tag to tell the browser you’re writing JavaScript 11 Your web browser ...

    Crack&逆向技术.7z

    Introduction This book is designed to help all...First, my special thanks to my friend Linda and my family, who tolerated my late−night sessions and my bad mood in the mornings when I had to go to work.

    piriform碎片整理大师

    In consideration of your agreeing to abide by the terms of this License and subject to your compliance with the terms of this License, Piriform grants you a non-exclusive, non-transferable license to ...

    aes加密异常:illegal Key Size 所需jdk jar包

    在调用企业微信通讯接口的时候,企业微信aes加密抛出了illegal key size异常,这个异常的原因是jdk jar包缺少lib导致的,不同jdk版本的jar包缺失不同,附件包含jdk6,jdk7,jdk8的jar包依赖,更新覆盖的时候,记得先...

    ICE 2.5 full source

    With ICE License it's easy to turn your application in "try-before-you-buy" versions with little effort, offering everything to guarantee a maximum protection. If you want to protect your investiments...

Global site tag (gtag.js) - Google Analytics