/// <summary> /// The entity instance is already in the session cache /// </summary> private void InstanceAlreadyLoaded( IDataReader rs, int i, ILoadable persister, string suffix, Key key, object obj, LockMode lockMode, ISessionImplementor session ) { if( !persister.MappedClass.IsAssignableFrom( obj.GetType() ) ) { throw new WrongClassException( "loading object was of wrong class", key.Identifier, persister.MappedClass ); } if( LockMode.None != lockMode && UpgradeLocks() ) { // we don't need to worry about existing version being uninitialized // because this block isn't called by a re-entrant load (re-entrant // load _always_ have lock mode NONE if( persister.IsVersioned && session.GetLockMode( obj ).LessThan( lockMode ) ) { // we only check the version when _upgrading_ lock modes CheckVersion( i, persister, key.Identifier, session.GetVersion( obj ), rs, session ); // we need to upgrade the lock mode to the mode requested session.SetLockMode( obj, lockMode ); } } }