public static void lock(Session ssn, Object obj) { Root root = ssn.getRoot(); Adapter ad = root.getAdapter(obj.getClass()); ObjectType type = ad.getObjectType(obj); Expression expr = new Filter (new Define(new All(type.getQualifiedName()), "this"), new Equals(new Variable("this"), new Literal(obj))); lock(ssn, expr);
public static void lock(Session ssn, Expression expr) { DataSet ds = new DataSet (ssn, new Signature() { public Query makeQuery(Session ssn, Expression e) { return new Query(e, true); } }, expr); Cursor c = ds.getCursor(); try { c.next(); } finally { c.close(); }
    public static void lock(Session ssn, Object obj) {        Root root = ssn.getRoot();        Adapter ad = root.getAdapter(obj.getClass());        ObjectType type = ad.getObjectType(obj);        Expression expr = new Filter            (new Define(new All(type.getQualifiedName()), "this"),             new Equals(new Variable("this"), new Literal(obj)));        lock(ssn, expr);    }