tx.lock(domainObject, Transaction.READ);
    public IDomainObject readByOId(IDomainObject obj, boolean lockWrite) {        tx = odmg.currentTransaction();        PersistenceBroker broker = ((HasBroker) tx).getBroker();        Identity identity = new Identity(obj, broker);        IDomainObject domainObject = (IDomainObject) ((TransactionImpl) tx)                .getObjectByIdentity(identity);        if (domainObject == null) {            return null;        }        if (lockWrite) {            tx.lock(domainObject, Transaction.WRITE);        } else {            tx.lock(domainObject, Transaction.READ);        }        return domainObject;    }