Hi,
i'm facing to the same problem than
http://forum.hibernate.org/viewtopic.ph ... 00#2231400 eventhough i'm not clearing the session.
Here is the code snippet :
Code:
try {
SnapShot snapShotClone = (SnapShot) BeanUtils.cloneBean(pIdentifiedObject);
//recursive method to mark all children
markSnapShot(snapShotClone, pUser, pIdentifiedObject.getId());
session = snapShotLocalSessionFactoryBean.getSnapShotSessionFactory().openSession();
transaction = session.beginTransaction();
session.save(snapShotClone);
transaction.commit();
return snapShotClone;
} catch (Exception e) {
try {
transaction.rollback();
} catch (Exception e1) {
logger.error(e1.getMessage());
}
throw new SnapShotException(e);
} finally {
try {
session.close();
} catch (Exception e) {
logger.error(e.getMessage());
}
}
And at stackTrace we can see Session is flushed :
[code]
Caused by: net.sf.hibernate.HibernateException: Found two representations of same collection
at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2866)
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
[code]
In Hibernate JIRA, it' s adviced to evict the object but didn' t even loaded it before and din' t called session.clear() !!!
How should i fix this ?
Thank you in advance ![/code]