-->
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 two representations of same collection Exception
PostPosted: Thu Nov 15, 2007 6:36 pm 
Beginner
Beginner

Joined: Thu Jun 17, 2004 10:08 am
Posts: 21
Location: Paris-France
Objects structure:

Project<1-*>DataSourceSchema<1-1>VersionedSource<1-1>AbstractSource<1-1>Configuration.
also
Project<1-*>Archive

All the object are JPA entities beside the Configuration object which is a UserType

Workflow
1.create HB session
2. create a project object
3. save project --OK (insert are made into the DB)
4. modify project
5. save project -- here the exception occurs (Found two representations of same collection: Project.archives)
6.close HB session


Hibernate version:
Hibernate 3.2.4

Code between sessionFactory.openSession() and session.close():
public void save(T objectToSave) {
EntityManager em = this.getEntityManager();

if (!em.getTransaction().isActive()) {
em.getTransaction().begin();
}

((Session) em.getDelegate()).saveOrUpdate(objectToSave);

em.getTransaction().commit();
}

Full stack trace of any exception that occurs:
javax.persistence.RollbackException: Error while commiting the transaction
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
at com.bobj.datafederator.designer.domain.dao.jpa.LocalThreadDataAccess.delete(LocalThreadDataAccess.java:73)
at com.bobj.datafederator.designer.domain.dao.jpa.LocalThreadDataAccess.delete(LocalThreadDataAccess.java:1)
at com.bobj.datafederator.designer.domain.ProjectDaoService.delete(ProjectDaoService.java:99)
at com.bobj.datafederator.designer.domain.ProjectDaoService.deleteAllProjects(ProjectDaoService.java:108)
at com.bobj.datafederator.designer.DfTestCase.deleteAllProjects(DfTestCase.java:64)
at com.bobj.datafederator.designer.DfTestCase.setUp(DfTestCase.java:44)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.hibernate.HibernateException: Found two representations of same collection: com.bobj.datafederator.designer.domain.Project.archives
at org.hibernate.engine.Collections.processReachableCollection(Collections.java:153)
at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)
at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:131)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)

Name and version of the database you are using:
HSQLDB


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.