Hi,
Hibernate version: 3.1.3
I'm very supprised. If LazySource contains a set of other entities, the following code
Quote:
beginTransaction();
LazySource readSource = (LazySource) getSession().get(LazySource.class, source.getId());
getSession().clear();
getSession().lock(readSource, LockMode.NONE);
commit();
produces the exception
org.hibernate.HibernateException: reassociated object has dirty collection reference
at org.hibernate.event.def.OnLockVisitor.processCollection(OnLockVisitor.java:59)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
...
As reason I found that after clear session the persistent context is proper cleared, but the session located in the cleared collection is not. Shouldn't session.clear() also do sth. like persistentCollection.removeSession(..) forall collections contained in the session?