else if (dataType.isEntityType()) {
// generate this:
// entityManager.find(Key.fromJson(entityManager, candidate.get(${propertyPath}).isObject(), false), NO_SIDE_EFFECTS);
// FIXME running a query that uses this in a where clause will be an O(N^2) operation on the number of entities. :-(
return new TernaryStatement(
Bool.notEquals(Stmt.loadVariable("candidate").invoke("get", dotNode.getPropertyPath()).invoke("isNull"), null),
Stmt.loadLiteral(null),
Stmt.loadVariable("entityManager").invoke("find",
Stmt.invokeStatic(Key.class, "fromJsonObject",
Stmt.loadVariable("entityManager"),