public Query getQuery(Object obj) { ObjectMap om = Session.getObjectMap(obj); ObjectType type = om.getObjectType(); if (om.getRetrieveAll() == null) { Property key = (Property) type.getKeyProperties().iterator().next(); return getQuery(obj, key); }
public Query getQuery(ObjectType type) { ObjectMap om = Root.getRoot().getObjectMap(type);
    public Query getQuery(Object obj) {        ObjectMap om = Session.getObjectMap(obj);        ObjectType type = om.getObjectType();        if (om.getRetrieveAll() == null) {            Property key =                (Property) type.getKeyProperties().iterator().next();            return getQuery(obj, key);        }        Signature sig = getSignature(type, om.getRetrieveAll(), null, false);        Parameter start = new Parameter(type, Path.get("__start__"));        sig.addParameter(start);        Query result = new Query            (sig, new EqualsFilter(null, start.getPath()));        result.set(start, obj);        return result;    }