-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Found shared references to a collection
PostPosted: Wed Apr 24, 2013 4:52 pm 
Newbie

Joined: Wed Apr 24, 2013 4:32 pm
Posts: 2
we are getting below error when we try to upgrade our project from Hibernate 3.x to 4.1.11. Compilation is going fine but our Junit tests are failing with below error. We could see failing statement in our debug at "entitymanager.flush()" statement. Not sure why its not cleaning particular object from entity manager after it commits, due to that Found shared references issue is occurring. Can any one help us with this how to solve this.

testTravelerCreateHistory(com.carlson.cwt.portrait.domain.history.BusinessTravelerWriteHistoryTest) Time elapsed: 0.061 sec <<< ERROR!
org.springframework.orm.hibernate3.HibernateSystemException: Found shared references to a collection: com.carlson.cwt.portrait.domain.organization.ClientOrgUnit.clientEmailAddresses; nested exception is org.hibernate.HibernateException: Found shared references to a collection: com.carlson.cwt.portrait.domain.organization.ClientOrgUnit.clientEmailAddresses
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:690)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:104)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.orm.jpa.JpaAccessor.translateIfNecessary(JpaAccessor.java:155)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:192)
at org.springframework.orm.jpa.JpaTemplate.flush(JpaTemplate.java:292)
at com.carlson.cwt.portrait.domain.traveler.dao.BusinessTravelerJpaDaoBean.flush(BusinessTravelerJpaDaoBean.java:799)
at com.carlson.cwt.portrait.domain.history.BusinessTravelerWriteHistoryTest.testTravelerCreateHistory(BusinessTravelerWriteHistoryTest.java:142)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:79)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$1(AbstractAnnotationAwareTransactionalTests.java:1)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run(AbstractAnnotationAwareTransactionalTests.java:179)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:287)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed(AbstractAnnotationAwareTransactionalTests.java:258)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:176)
at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:195)
at com.carlson.cwt.test.AbstractCwtJpaTestCase.runBare(AbstractCwtJpaTestCase.java:56)
at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:276)
at com.carlson.cwt.test.AbstractCwtJpaTestCase.runBare(AbstractCwtJpaTestCase.java:56)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:308)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:879)
Caused by: org.hibernate.HibernateException: Found shared references to a collection: com.carlson.cwt.portrait.domain.organization.ClientOrgUnit.clientEmailAddresses
at org.hibernate.engine.internal.Collections.processReachableCollection(Collections.java:177)
at org.hibernate.event.internal.FlushVisitor.processCollection(FlushVisitor.java:59)
at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:121)
at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:82)
at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76)
at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:174)
at com.carlson.cwt.portrait.domain.event.ProfileEntityFlushEventListener.onFlushEntity(ProfileEntityFlushEventListener.java:37)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:225)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1213)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:996)
at org.springframework.orm.jpa.JpaTemplate$8.doInJpa(JpaTemplate.java:294)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:187)
... 36 more


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.