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