An example of what I am trying to achieve is
String randVal = "child-" + randomPosition();
if (_randomValueQuery == null) {
_randomValueQuery = newQuery().cached();
_randomValueQuery.onCache().constrain(DBTree.class);
_randomValueQuery.onCache().descend("_root").constrain(root1);
} else {
_randomValueQuery.init();
}
_randomValueQuery.descend("_node").constrain(randVal);
Iterator it = _randomValueQuery.execute().iterator();