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]);
assertThat(query.getStatement(), is(sql));
QueryResult result = query.execute();
validateQuery().rowCount(1).validate(query, result);