// Condition on key
SQLExpression keyExpr = exprFactory.newExpression(subStmt, subStmt.getPrimaryTable(), indexMapping);
subStmt.whereAnd(keyExpr.eq(idxExpr), true);
// Create subquery, with mapping being of the element type (since "get" returns an element)
SubqueryExpression subExpr = new SubqueryExpression(stmt, subStmt);
subExpr.setJavaTypeMapping(elemMapping);
return subExpr;
}