HHH-4948 : Session.flush() does not always cascade save or update to read-only or immutable entities

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18872 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gail Badner 2010-02-24 20:21:08 +00:00
parent 5e71ea4c55
commit d26e4f1cad
1 changed files with 4 additions and 8 deletions

View File

@ -285,11 +285,9 @@ public class DefaultSaveOrUpdateEventListener extends AbstractSaveEventListener
Object entity, Object entity,
EntityPersister persister) throws HibernateException { EntityPersister persister) throws HibernateException {
if ( !persister.isMutable() ) { if ( !persister.isMutable() ) {
log.trace( "immutable instance passed to doUpdate(), locking" ); log.trace( "immutable instance passed to performUpdate()" );
reassociate( event, entity, event.getRequestedId(), persister ); }
}
else {
if ( log.isTraceEnabled() ) { if ( log.isTraceEnabled() ) {
log.trace( log.trace(
@ -329,7 +327,7 @@ public class DefaultSaveOrUpdateEventListener extends AbstractSaveEventListener
source.getPersistenceContext().addEntity( source.getPersistenceContext().addEntity(
entity, entity,
Status.MANAGED, ( persister.isMutable() ? Status.MANAGED : Status.READ_ONLY ),
null, //cachedState, null, //cachedState,
key, key,
persister.getVersion( entity, source.getEntityMode() ), persister.getVersion( entity, source.getEntityMode() ),
@ -350,8 +348,6 @@ public class DefaultSaveOrUpdateEventListener extends AbstractSaveEventListener
} }
cascadeOnUpdate( event, persister, entity ); cascadeOnUpdate( event, persister, entity );
}
} }
protected boolean invokeUpdateLifecycle(Object entity, EntityPersister persister, EventSource source) { protected boolean invokeUpdateLifecycle(Object entity, EntityPersister persister, EventSource source) {