return load( type, (Object)identity, accessMode );
}
public Object load( Class type, Object identity, short accessMode) throws ObjectNotFoundException, LockNotGrantedException, TransactionNotInProgressException, PersistenceException {
TransactionContext tx;
PersistenceInfo info;
AccessMode mode;
switch ( accessMode ) {
case ReadOnly:
mode = AccessMode.ReadOnly;
break;
case Shared:
mode = AccessMode.Shared;
break;
case Exclusive:
mode = AccessMode.Exclusive;
break;
case DbLocked:
mode = AccessMode.DbLocked;
break;
default:
throw new IllegalArgumentException( "Value for 'accessMode' is invalid" );
}
tx = getTransaction();
info = _scope.getPersistenceInfo( type );
if ( info == null )
throw new ClassNotPersistenceCapableException( Messages.format("persist.classNotPersistenceCapable", type.getName()) );
return tx.load( info.engine, info.molder, identity, null, mode );
}