// setup compare to vars first, so we can compre types in from vars
ASTPath toPath = (ASTPath) node.jjtGetChild(1);
JDBCCMRFieldBridge toCMRField = (JDBCCMRFieldBridge) toPath.getCMRField();
JDBCEntityBridge toChildEntity = (JDBCEntityBridge) toPath.getEntity();
String pathStr = toPath.getPath(toPath.size() - 2);
String toParentAlias = aliasManager.getAlias(pathStr);
String toChildAlias = aliasManager.getAlias(toPath.getPath());
String relationTableAlias = null;
if(toCMRField.getRelationMetaData().isTableMappingStyle())
{
relationTableAlias = aliasManager.getRelationTableAlias(toPath.getPath());
}
// setup from variables
String fromAlias = null;
int fromParamNumber = -1;
if(node.jjtGetChild(0) instanceof ASTParameter)
{
ASTParameter fromParam = (ASTParameter) node.jjtGetChild(0);
// can only compare like kind entities
verifyParameterEntityType(fromParam.number, toChildEntity);
fromParamNumber = fromParam.number;
}
else
{
ASTPath fromPath = (ASTPath) node.jjtGetChild(0);
addJoinPath(fromPath);
JDBCEntityBridge fromEntity = (JDBCEntityBridge) fromPath.getEntity();
fromAlias = aliasManager.getAlias(fromPath.getPath());
// can only compare like kind entities
if(!fromEntity.equals(toChildEntity))
{
throw new IllegalStateException("Only like types can be " +
"compared: from entity=" +
fromEntity.getEntityName() +
" to entity=" + toChildEntity.getEntityName());
}
}
// add the path to the list of paths to left join