net.sf.hibernate.HibernateException: You may not change the reference to a collection with cascade="all-delete-orphan"

Hibernate JIRA | Martin Hackmann | 1 decade ago
  1. 0

    The following code produces the exception. There are two classes Parent and Child with a bidirectional one-to-many relationship with all-delete-orphan. Id do an saveOrUpdate and use an Interceptor to force an insert to clone the persistent graph in the database. In another test I setted the id explicit to null and got the same exception. I looked through the Hibernate code: my suggestions is, that the bug is related to the fact, that the java-collections are replaced by Hibernate-collections and that the check that yield to that exception is not correct in this case ? Hope this will help! ---------------------------------------------------------------- public static void main(String[] args) throws Exception { try { Configuration cfg = new Configuration(); cfg.configure(); SessionFactory factory = cfg.buildSessionFactory(); Parent p = new Parent(); Child c1 = new Child(); Child c2 = new Child(); p.setChilds(new HashSet(Arrays.asList(new Child[] { c1, c2 }))); // normal insert: ok! Session s1 = factory.openSession(); Transaction tx1 = s1.beginTransaction(); s1.saveOrUpdate(p); tx1.commit(); s1.close(); // persistent clone: exception! Session s2 = factory.openSession(new EmptyInterceptor() { public Boolean isUnsaved(Object entity) { return Boolean.TRUE; } }); Transaction tx2 = s2.beginTransaction(); s2.saveOrUpdate(p); tx2.commit(); s2.close(); } catch (HibernateException ex) { ex.printStackTrace(); } } The Trace is: 6:16:44,745 INFO Environment:462 - Hibernate 2.1.4 16:16:44,755 INFO Environment:491 - hibernate.properties not found 16:16:44,755 INFO Environment:522 - using CGLIB reflection optimizer 16:16:44,765 INFO Configuration:872 - configuring from resource: /hibernate.cfg.xml 16:16:44,765 INFO Configuration:844 - Configuration resource: /hibernate.cfg.xml 16:16:45,145 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/common/BuendelDTO.hbm.xml 16:16:45,286 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.common.BuendelDTO -> BUENDEL 16:16:45,426 INFO Binder:169 - Mapping subclass: de.vkb.bskg.dto.common.VorsorgeBuendelDTO -> BUENDEL 16:16:45,436 INFO Binder:169 - Mapping subclass: de.vkb.bskg.dto.buendel.FamilienBuendelDTO -> BUENDEL 16:16:45,436 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/kranken/KrankenPoliceDTO.hbm.xml 16:16:45,466 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.kranken.KrankenPoliceDTO -> KrankenPoliceDTO 16:16:45,486 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/kranken/KrankenVersicherterDTO.hbm.xml 16:16:45,546 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.kranken.KrankenVersicherterDTO -> KrankenVersicherterDTO 16:16:45,546 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/leben/LebenPoliceDTO.hbm.xml 16:16:45,586 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.leben.LebenPoliceDTO -> LebenPoliceDTO 16:16:45,596 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/leben/LebenVersicherterBerufDTO.hbm.xml 16:16:45,626 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.leben.LebenVersicherterBerufDTO -> LebenVersicherterBerufDTO 16:16:45,636 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/leben/LebenVersicherterDTO.hbm.xml 16:16:45,666 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.leben.LebenVersicherterDTO -> LebenVersicherterDTO 16:16:45,666 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/person/PersonDTO.hbm.xml 16:16:45,686 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.person.PersonDTO -> PersonDTO 16:16:45,686 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/unfall/UnfallPoliceDTO.hbm.xml 16:16:45,706 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.unfall.UnfallPoliceDTO -> UnfallPoliceDTO 16:16:45,716 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/unfall/UnfallVersicherterDTO.hbm.xml 16:16:45,736 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.unfall.UnfallVersicherterDTO -> UnfallVersicherterDTO 16:16:45,736 INFO Configuration:328 - Mapping resource: test/Parent.hbm.xml 16:16:45,756 INFO Binder:229 - Mapping class: test.Parent -> Parent 16:16:45,756 INFO Configuration:328 - Mapping resource: test/Child.hbm.xml 16:16:45,766 INFO Binder:229 - Mapping class: test.Child -> Child 16:16:45,766 INFO Configuration:1030 - Configured SessionFactory: null 16:16:45,766 INFO Configuration:613 - processing one-to-many association mappings 16:16:45,766 INFO Binder:1168 - Mapping collection: de.vkb.bskg.dto.common.BuendelDTO.personen -> PersonDTO 16:16:45,766 INFO Binder:1168 - Mapping collection: de.vkb.bskg.dto.kranken.KrankenPoliceDTO.versicherte -> KrankenVersicherterDTO 16:16:45,766 INFO Binder:1168 - Mapping collection: de.vkb.bskg.dto.unfall.UnfallPoliceDTO.versicherte -> UnfallVersicherterDTO 16:16:45,766 INFO Binder:1168 - Mapping collection: test.Parent.childs -> Child 16:16:45,776 INFO Configuration:622 - processing one-to-one association property references 16:16:45,776 INFO Configuration:647 - processing foreign key constraints 16:16:45,796 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.DB2Dialect 16:16:45,796 INFO SettingsFactory:62 - Use outer join fetching: true 16:16:45,806 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!) 16:16:45,806 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20 16:16:45,806 INFO DriverManagerConnectionProvider:77 - using driver: COM.ibm.db2.jdbc.net.DB2Driver at URL: jdbc:db2://localhost:6789/BSKG_TES 16:16:45,806 INFO DriverManagerConnectionProvider:78 - connection properties: {user=db2vips, password=db2vips} 16:16:45,816 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 16:16:46,658 INFO SettingsFactory:102 - Use scrollable result sets: false 16:16:46,658 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false 16:16:46,658 INFO SettingsFactory:108 - Optimize cache for minimal puts: false 16:16:46,658 INFO SettingsFactory:114 - echoing all SQL to stdout 16:16:46,658 INFO SettingsFactory:117 - Query language substitutions: {} 16:16:46,658 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider 16:16:46,658 INFO Configuration:1093 - instantiating and configuring caches 16:16:46,768 INFO SessionFactoryImpl:119 - building session factory 16:16:47,369 INFO SessionFactoryObjectFactory:82 - no JNDI name configured Hibernate: insert into Parent (id) values (default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Parent (id) values (default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() net.sf.hibernate.HibernateException: You may not change the reference to a collection with cascade="all-delete-orphan" at net.sf.hibernate.impl.SessionImpl.prepareCollectionForUpdate(SessionImpl.java:2949) at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2886) at net.sf.hibernate.impl.FlushVisitor.processCollection(FlushVisitor.java:32) at net.sf.hibernate.impl.AbstractVisitor.processValue(AbstractVisitor.java:69) at net.sf.hibernate.impl.AbstractVisitor.processValues(AbstractVisitor.java:36) at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2588) at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2454) at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2256) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2235) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61) at test.TestParent.main(TestParent.java:108) My mapping files are: <hibernate-mapping> <class name="test.Parent" dynamic-update="false" dynamic-insert="false" > <id name="id" column="id" type="java.lang.Long" unsaved-value="null" > <generator class="native"> </generator> </id> <set name="childs" lazy="false" inverse="true" cascade="all-delete-orphan" sort="unsorted" > <key column="parent" /> <one-to-many class="test.Child" /> </set> <!-- To add non XDoclet property mappings, create a file named hibernate-properties-Parent.xml containing the additional properties and place it in your merge dir. --> </class> </hibernate-mapping> <hibernate-mapping> <class name="test.Child" dynamic-update="false" dynamic-insert="false" > <id name="id" column="id" type="java.lang.Long" unsaved-value="null" > <generator class="native"> </generator> </id> <many-to-one name="parent" class="test.Parent" cascade="none" outer-join="auto" update="true" insert="true" column="parent" not-null="true" /> </class> </hibernate-mapping> And the DTOs: public class Parent { private Long id; private Set childs = new HashSet(); public Long getId() { return id; } public void setId(Long long1) { id = long1; } public Set getChilds() { return childs; } public void setChilds(Set set) { childs = set; for (Iterator iter = childs.iterator(); iter.hasNext();) { Child child = (Child) iter.next(); child.setParent(this); } } } public class Child { private Long id; private Parent parent; public Long getId() { return id; } public void setId(Long long1) { id = long1; } public Parent getParent() { return parent; } public void setParent(Parent parent) { this.parent = parent; } }

    Hibernate JIRA | 1 decade ago | Martin Hackmann
    net.sf.hibernate.HibernateException: You may not change the reference to a collection with cascade="all-delete-orphan"
  2. 0

    The following code produces the exception. There are two classes Parent and Child with a bidirectional one-to-many relationship with all-delete-orphan. Id do an saveOrUpdate and use an Interceptor to force an insert to clone the persistent graph in the database. In another test I setted the id explicit to null and got the same exception. I looked through the Hibernate code: my suggestions is, that the bug is related to the fact, that the java-collections are replaced by Hibernate-collections and that the check that yield to that exception is not correct in this case ? Hope this will help! ---------------------------------------------------------------- public static void main(String[] args) throws Exception { try { Configuration cfg = new Configuration(); cfg.configure(); SessionFactory factory = cfg.buildSessionFactory(); Parent p = new Parent(); Child c1 = new Child(); Child c2 = new Child(); p.setChilds(new HashSet(Arrays.asList(new Child[] { c1, c2 }))); // normal insert: ok! Session s1 = factory.openSession(); Transaction tx1 = s1.beginTransaction(); s1.saveOrUpdate(p); tx1.commit(); s1.close(); // persistent clone: exception! Session s2 = factory.openSession(new EmptyInterceptor() { public Boolean isUnsaved(Object entity) { return Boolean.TRUE; } }); Transaction tx2 = s2.beginTransaction(); s2.saveOrUpdate(p); tx2.commit(); s2.close(); } catch (HibernateException ex) { ex.printStackTrace(); } } The Trace is: 6:16:44,745 INFO Environment:462 - Hibernate 2.1.4 16:16:44,755 INFO Environment:491 - hibernate.properties not found 16:16:44,755 INFO Environment:522 - using CGLIB reflection optimizer 16:16:44,765 INFO Configuration:872 - configuring from resource: /hibernate.cfg.xml 16:16:44,765 INFO Configuration:844 - Configuration resource: /hibernate.cfg.xml 16:16:45,145 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/common/BuendelDTO.hbm.xml 16:16:45,286 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.common.BuendelDTO -> BUENDEL 16:16:45,426 INFO Binder:169 - Mapping subclass: de.vkb.bskg.dto.common.VorsorgeBuendelDTO -> BUENDEL 16:16:45,436 INFO Binder:169 - Mapping subclass: de.vkb.bskg.dto.buendel.FamilienBuendelDTO -> BUENDEL 16:16:45,436 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/kranken/KrankenPoliceDTO.hbm.xml 16:16:45,466 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.kranken.KrankenPoliceDTO -> KrankenPoliceDTO 16:16:45,486 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/kranken/KrankenVersicherterDTO.hbm.xml 16:16:45,546 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.kranken.KrankenVersicherterDTO -> KrankenVersicherterDTO 16:16:45,546 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/leben/LebenPoliceDTO.hbm.xml 16:16:45,586 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.leben.LebenPoliceDTO -> LebenPoliceDTO 16:16:45,596 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/leben/LebenVersicherterBerufDTO.hbm.xml 16:16:45,626 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.leben.LebenVersicherterBerufDTO -> LebenVersicherterBerufDTO 16:16:45,636 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/leben/LebenVersicherterDTO.hbm.xml 16:16:45,666 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.leben.LebenVersicherterDTO -> LebenVersicherterDTO 16:16:45,666 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/person/PersonDTO.hbm.xml 16:16:45,686 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.person.PersonDTO -> PersonDTO 16:16:45,686 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/unfall/UnfallPoliceDTO.hbm.xml 16:16:45,706 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.unfall.UnfallPoliceDTO -> UnfallPoliceDTO 16:16:45,716 INFO Configuration:328 - Mapping resource: de/vkb/bskg/dto/unfall/UnfallVersicherterDTO.hbm.xml 16:16:45,736 INFO Binder:229 - Mapping class: de.vkb.bskg.dto.unfall.UnfallVersicherterDTO -> UnfallVersicherterDTO 16:16:45,736 INFO Configuration:328 - Mapping resource: test/Parent.hbm.xml 16:16:45,756 INFO Binder:229 - Mapping class: test.Parent -> Parent 16:16:45,756 INFO Configuration:328 - Mapping resource: test/Child.hbm.xml 16:16:45,766 INFO Binder:229 - Mapping class: test.Child -> Child 16:16:45,766 INFO Configuration:1030 - Configured SessionFactory: null 16:16:45,766 INFO Configuration:613 - processing one-to-many association mappings 16:16:45,766 INFO Binder:1168 - Mapping collection: de.vkb.bskg.dto.common.BuendelDTO.personen -> PersonDTO 16:16:45,766 INFO Binder:1168 - Mapping collection: de.vkb.bskg.dto.kranken.KrankenPoliceDTO.versicherte -> KrankenVersicherterDTO 16:16:45,766 INFO Binder:1168 - Mapping collection: de.vkb.bskg.dto.unfall.UnfallPoliceDTO.versicherte -> UnfallVersicherterDTO 16:16:45,766 INFO Binder:1168 - Mapping collection: test.Parent.childs -> Child 16:16:45,776 INFO Configuration:622 - processing one-to-one association property references 16:16:45,776 INFO Configuration:647 - processing foreign key constraints 16:16:45,796 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.DB2Dialect 16:16:45,796 INFO SettingsFactory:62 - Use outer join fetching: true 16:16:45,806 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!) 16:16:45,806 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 20 16:16:45,806 INFO DriverManagerConnectionProvider:77 - using driver: COM.ibm.db2.jdbc.net.DB2Driver at URL: jdbc:db2://localhost:6789/BSKG_TES 16:16:45,806 INFO DriverManagerConnectionProvider:78 - connection properties: {user=db2vips, password=db2vips} 16:16:45,816 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 16:16:46,658 INFO SettingsFactory:102 - Use scrollable result sets: false 16:16:46,658 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false 16:16:46,658 INFO SettingsFactory:108 - Optimize cache for minimal puts: false 16:16:46,658 INFO SettingsFactory:114 - echoing all SQL to stdout 16:16:46,658 INFO SettingsFactory:117 - Query language substitutions: {} 16:16:46,658 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider 16:16:46,658 INFO Configuration:1093 - instantiating and configuring caches 16:16:46,768 INFO SessionFactoryImpl:119 - building session factory 16:16:47,369 INFO SessionFactoryObjectFactory:82 - no JNDI name configured Hibernate: insert into Parent (id) values (default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Parent (id) values (default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() Hibernate: insert into Child (parent, id) values (?, default) Hibernate: values IDENTITY_VAL_LOCAL() net.sf.hibernate.HibernateException: You may not change the reference to a collection with cascade="all-delete-orphan" at net.sf.hibernate.impl.SessionImpl.prepareCollectionForUpdate(SessionImpl.java:2949) at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2886) at net.sf.hibernate.impl.FlushVisitor.processCollection(FlushVisitor.java:32) at net.sf.hibernate.impl.AbstractVisitor.processValue(AbstractVisitor.java:69) at net.sf.hibernate.impl.AbstractVisitor.processValues(AbstractVisitor.java:36) at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2588) at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2454) at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2256) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2235) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61) at test.TestParent.main(TestParent.java:108) My mapping files are: <hibernate-mapping> <class name="test.Parent" dynamic-update="false" dynamic-insert="false" > <id name="id" column="id" type="java.lang.Long" unsaved-value="null" > <generator class="native"> </generator> </id> <set name="childs" lazy="false" inverse="true" cascade="all-delete-orphan" sort="unsorted" > <key column="parent" /> <one-to-many class="test.Child" /> </set> <!-- To add non XDoclet property mappings, create a file named hibernate-properties-Parent.xml containing the additional properties and place it in your merge dir. --> </class> </hibernate-mapping> <hibernate-mapping> <class name="test.Child" dynamic-update="false" dynamic-insert="false" > <id name="id" column="id" type="java.lang.Long" unsaved-value="null" > <generator class="native"> </generator> </id> <many-to-one name="parent" class="test.Parent" cascade="none" outer-join="auto" update="true" insert="true" column="parent" not-null="true" /> </class> </hibernate-mapping> And the DTOs: public class Parent { private Long id; private Set childs = new HashSet(); public Long getId() { return id; } public void setId(Long long1) { id = long1; } public Set getChilds() { return childs; } public void setChilds(Set set) { childs = set; for (Iterator iter = childs.iterator(); iter.hasNext();) { Child child = (Child) iter.next(); child.setParent(this); } } } public class Child { private Long id; private Parent parent; public Long getId() { return id; } public void setId(Long long1) { id = long1; } public Parent getParent() { return parent; } public void setParent(Parent parent) { this.parent = parent; } }

    Hibernate JIRA | 1 decade ago | Martin Hackmann
    net.sf.hibernate.HibernateException: You may not change the reference to a collection with cascade="all-delete-orphan"
  3. 0

    I'm not sure if this is MySQL related or not, it occurs on the OpenSymphony Confluence instance trying to remove pages. org.springframework.orm.hibernate.HibernateSystemException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations); nested exception is: net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations) net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2174) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:711) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1319) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482) at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2583) at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2190) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2179) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61) at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:309) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:218) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:172) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy83.removeContentEntity(Unknown Source) at com.atlassian.confluence.pages.actions.RemovePageAction.doRemove(RemovePageAction.java:45)

    Atlassian JIRA | 1 decade ago | Mike Cannon-Brookes
    net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    trying to remove this page http://confluence.atlassian.com/display/DISC/testing%2Bsearch produces this error : Cause: org.springframework.orm.hibernate.HibernateSystemException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations); nested exception is: net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations) Stack Trace: [hide] org.springframework.orm.hibernate.HibernateSystemException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations); nested exception is: net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations) net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2174) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:711) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1319) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482) at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2583) at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2190) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2179) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61) at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:309) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:218) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:172) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy97.removeContentEntity(Unknown Source) at com.atlassian.confluence.pages.actions.RemovePageAction.doRemove(RemovePageAction.java:45) 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:324) at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:309) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:175) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor.intercept(DefaultWorkflowInterceptor.java:58) at com.atlassian.confluence.core.ConfluenceWorkflowInterceptor.intercept(ConfluenceWorkflowInterceptor.java:32) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.atlassian.confluence.core.ConfluenceValidationInterceptor.intercept(ConfluenceValidationInterceptor.java:18) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.atlassian.confluence.security.actions.PermissionCheckInterceptor.intercept(PermissionCheckInterceptor.java:40) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:170) at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116) at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:182) at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:162) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:129) at com.atlassian.confluence.util.profiling.ProfilingPageFilter.parsePage(ProfilingPageFilter.java:36) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:61) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:161) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at com.atlassian.seraph.filter.LoginFilter.doFilter(LoginFilter.java:181) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at com.atlassian.johnson.filters.JohnsonFilter.doFilter(JohnsonFilter.java:96) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:83) at com.atlassian.confluence.setup.SpringSessionInViewFilter.doFilterInternal(SpringSessionInViewFilter.java:32) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:39) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at com.atlassian.util.profiling.filters.ProfilingFilter.doFilter(ProfilingFilter.java:132) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at com.atlassian.core.filters.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:38) at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88) at com.caucho.server.http.Invocation.service(Invocation.java:315) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246) at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163) at com.caucho.server.TcpConnection.run(TcpConnection.java:139) at java.lang.Thread.run(Thread.java:534) Referer URL: http://confluence.atlassian.com/pages/removepage.action?spaceKey=DISC&title=testing+search System Information: System Date: Wednesday, 28 Jan 2004

    Atlassian JIRA | 1 decade ago | Zohar Melamed
    net.sf.hibernate.HibernateException: Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade (remove deleted object from associations)
  6. 0

    I get this exception when trying to edit my personal description: org.springframework.orm.hibernate.HibernateSystemException: Found shared references to a collection; nested exception is: net.sf.hibernate.HibernateException: Found shared references to a collection net.sf.hibernate.HibernateException: Found shared references to a collection at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2785) at net.sf.hibernate.impl.FlushVisitor.processCollection(FlushVisitor.java:63) at net.sf.hibernate.impl.AbstractVisitor.processValue(AbstractVisitor.java:137) at net.sf.hibernate.impl.AbstractVisitor.processValues(AbstractVisitor.java:71) at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2500) at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2366) at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2200) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2179) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61) at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:309) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:218) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:172) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:196) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:135) at $Proxy6.savePersonalInformation(Unknown Source) at com.atlassian.confluence.user.actions.EditMyProfileAction.updatePersonalInformation(EditMyProfileAction.java:113) at com.atlassian.confluence.user.actions.EditMyProfileAction.doEdit(EditMyProfileAction.java:70)

    Atlassian JIRA | 1 decade ago | Mike Cannon-Brookes
    net.sf.hibernate.HibernateException: Found shared references to a collection

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.HibernateException

      You may not change the reference to a collection with cascade="all-delete-orphan"

      at net.sf.hibernate.impl.SessionImpl.prepareCollectionForUpdate()
    2. net.sf.hibernate
      JDBCTransaction.commit
      1. net.sf.hibernate.impl.SessionImpl.prepareCollectionForUpdate(SessionImpl.java:2949)
      2. net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2886)
      3. net.sf.hibernate.impl.FlushVisitor.processCollection(FlushVisitor.java:32)
      4. net.sf.hibernate.impl.AbstractVisitor.processValue(AbstractVisitor.java:69)
      5. net.sf.hibernate.impl.AbstractVisitor.processValues(AbstractVisitor.java:36)
      6. net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2588)
      7. net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2454)
      8. net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2256)
      9. net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2235)
      10. net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
      10 frames
    3. test
      TestParent.main
      1. test.TestParent.main(TestParent.java:108)
      1 frame