if (from == null)
{
from = lambdaContext.joins.addFrom(link.joinInfo.get(0).toTableName);
for (int n = 0; n < link.joinInfo.get(0).fromColumns.size(); n++)
{
SQLFragment where = new SQLFragment();
String fromCol = link.joinInfo.get(0).fromColumns.get(n);
String toCol = link.joinInfo.get(0).toColumns.get(n);
int fromColIdx = base.reader.getColumnIndexForColumnName(fromCol);
if (fromColIdx < 0) throw new TypedValueVisitorException("Cannot find column for navigational query: " + val);
where.add("(");
where.add(base.getColumn(fromColIdx));
where.add(") = (");
where.add(from);
where.add("." + toCol);
where.add(")");
lambdaContext.joins.addWhere(where);
}
lambdaContext.joins.addCachedJoin(link.fromEntity, link.name, fromKey, from);
}
EntityManagerBackdoor em = lambdaContext.joins.getEntityManager();
SQLColumnValues joinedEntity = new SQLColumnValues<T>(em.getReaderForEntity(link.toEntity));
String []columnNames = em.getEntityColumnNames(link.toEntity);
for (int n = 0; n < columnNames.length; n++)
{
SQLFragment fragment = new SQLFragment();
fragment.add(from);
fragment.add("." + columnNames[n]);
joinedEntity.columns[n] = fragment;
}
return joinedEntity;
// throw new TypedValueVisitorException("Unhandled N:1 or 1:1 navigational query:" + val);
}