HHH-2816 avoid re-selecting state for READ_ONLY in checkNaturalId

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14015 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Chris Bredesen 2007-09-20 21:58:27 +00:00
parent b8d21487bf
commit 45667c1c79
1 changed files with 4 additions and 4 deletions

View File

@ -68,12 +68,12 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
private void checkNaturalId( private void checkNaturalId(
EntityPersister persister, EntityPersister persister,
Serializable identifier, EntityEntry entry,
Object[] current, Object[] current,
Object[] loaded, Object[] loaded,
EntityMode entityMode, EntityMode entityMode,
SessionImplementor session) { SessionImplementor session) {
if ( persister.hasNaturalIdentifier() ) { if ( persister.hasNaturalIdentifier() && entry.getStatus() != Status.READ_ONLY ) {
Object[] snapshot = null; Object[] snapshot = null;
Type[] types = persister.getPropertyTypes(); Type[] types = persister.getPropertyTypes();
int[] props = persister.getNaturalIdentifierProperties(); int[] props = persister.getNaturalIdentifierProperties();
@ -84,7 +84,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
Object loadedVal; Object loadedVal;
if ( loaded == null ) { if ( loaded == null ) {
if ( snapshot == null) { if ( snapshot == null) {
snapshot = session.getPersistenceContext().getNaturalIdSnapshot( identifier, persister ); snapshot = session.getPersistenceContext().getNaturalIdSnapshot( entry.getId(), persister );
} }
loadedVal = snapshot[i]; loadedVal = snapshot[i];
} else { } else {
@ -166,7 +166,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
// grab its current state // grab its current state
values = persister.getPropertyValues( entity, entityMode ); values = persister.getPropertyValues( entity, entityMode );
checkNaturalId( persister, entry.getId(), values, loadedState, entityMode, session ); checkNaturalId( persister, entry, values, loadedState, entityMode, session );
} }
return values; return values;
} }