session.save();
// query for a property present in a subtype which doesn't have any residuals, using a super-type selector
String sql = "SELECT * FROM [nt:base] AS node WHERE node.fieldA = 'A_value'";
try {
QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
Selector selector = qomFactory.selector("nt:base", "node");
PropertyValue propValue = qomFactory.propertyValue("node", "fieldA");
Literal literal = qomFactory.literal(session.getValueFactory().createValue("A_value"));
Constraint constraint = qomFactory.comparison(propValue, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, literal);
Query query = qomFactory.createQuery(selector, constraint, null, new Column[0]);