use of org.hibernate.internal.util.collections.IdentityMap in project hibernate-orm by hibernate.
the class AbstractFlushingEventListener method prepareEntityFlushes.
/**
* process cascade save/update at the start of a flush to discover
* any newly referenced entity that must be passed to saveOrUpdate(),
* and also apply orphan delete
*/
private void prepareEntityFlushes(EventSource session, PersistenceContext persistenceContext) throws HibernateException {
LOG.debug("Processing flush-time cascades");
final Object anything = getAnything();
// safe from concurrent modification because of how concurrentEntries() is implemented on IdentityMap
for (Map.Entry<Object, EntityEntry> me : persistenceContext.reentrantSafeEntityEntries()) {
// for ( Map.Entry me : IdentityMap.concurrentEntries( persistenceContext.getEntityEntries() ) ) {
EntityEntry entry = (EntityEntry) me.getValue();
Status status = entry.getStatus();
if (status == Status.MANAGED || status == Status.SAVING || status == Status.READ_ONLY) {
cascadeOnFlush(session, entry.getPersister(), me.getKey(), anything);
}
}
}
Aggregations