Author: max.andersen(a)jboss.com
Date: 2006-09-21 21:51:36 -0400 (Thu, 21 Sep 2006)
New Revision: 10520
Modified:
trunk/Hibernate3/src/org/hibernate/event/def/AbstractFlushingEventListener.java
Log:
HHH-2093 PERSIST_ON_FLUSH ineffective for recursive object graphs
Modified: trunk/Hibernate3/src/org/hibernate/event/def/AbstractFlushingEventListener.java
===================================================================
---
trunk/Hibernate3/src/org/hibernate/event/def/AbstractFlushingEventListener.java 2006-09-22
01:51:29 UTC (rev 10519)
+++
trunk/Hibernate3/src/org/hibernate/event/def/AbstractFlushingEventListener.java 2006-09-22
01:51:36 UTC (rev 10520)
@@ -113,22 +113,23 @@
final Map.Entry[] list = IdentityMap.concurrentEntries(
session.getPersistenceContext().getEntityEntries() );
//safe from concurrent modification because of how entryList() is implemented on
IdentityMap
final int size = list.length;
+ final Object anything = getAnything();
for ( int i=0; i<size; i++ ) {
Map.Entry me = list[i];
EntityEntry entry = (EntityEntry) me.getValue();
Status status = entry.getStatus();
if ( status == Status.MANAGED || status == Status.SAVING ) {
- cascadeOnFlush( session, entry.getPersister(), me.getKey() );
+ cascadeOnFlush( session, entry.getPersister(), me.getKey(), anything );
}
}
}
- private void cascadeOnFlush(EventSource session, EntityPersister persister, Object
object)
+ private void cascadeOnFlush(EventSource session, EntityPersister persister, Object
object, Object anything)
throws HibernateException {
session.getPersistenceContext().incrementCascadeLevel();
try {
new Cascade( getCascadingAction(), Cascade.BEFORE_FLUSH, session )
- .cascade( persister, object, getAnything() );
+ .cascade( persister, object, anything );
}
finally {
session.getPersistenceContext().decrementCascadeLevel();