-->
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: Empty collection causes "two rep. of same collection"
PostPosted: Tue Apr 26, 2011 2:47 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Hi,

When persisting an Entity which contains a collection I recently got the following Exception:
Code:
org.hibernate.HibernateException: Found two representations of same collection: khdb.entities.KladdenEntry.verkaeufe
   at org.hibernate.engine.Collections.processReachableCollection(Collections.java:175)
   at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:60)
   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.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:165)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)
   at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
   at khdb.util.DTExecutor.startExecution(DTExecutor.java:31)


However the code in question looks like:
Code:
KladdenEntry e = new KladdenEntry();
e.verkaeufe = new ArrayList();
session.persist(e);


How can a duplicate representation of the collection exist if it's initialized to an empty ArrayList right after initialization.

Any idea why hibernate gets fed up? ;)

Thanks, Clemens


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.