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:
parent
5e71ea4c55
commit
d26e4f1cad
|
@ -286,10 +286,8 @@ public class DefaultSaveOrUpdateEventListener extends AbstractSaveEventListener
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue