}
ASTPath fromPath = (ASTPath) fromNode;
addLeftJoinPath(fromPath);
String fromAlias = aliasManager.getAlias(fromPath.getPath());
JDBCAbstractEntityBridge fromEntity = (JDBCAbstractEntityBridge) fromPath.getEntity();
if (toNode instanceof ASTParameter) {
ASTParameter toParam = (ASTParameter) toNode;
// can only compare like kind entities
verifyParameterEntityType(toParam.number, fromEntity);
inputParameters.addAll(QueryParameter.createParameters(toParam.number - 1, fromEntity));
SQLUtil.getWhereClause(fromEntity.getPrimaryKeyFields(), fromAlias, buf);
} else {
ASTPath toPath = (ASTPath) toNode;
addLeftJoinPath(toPath);
String toAlias = aliasManager.getAlias(toPath.getPath());
JDBCAbstractEntityBridge toEntity = (JDBCAbstractEntityBridge) toPath.getEntity();
// can only compare like kind entities
if (!fromEntity.equals(toEntity)) {
throw CmpMessages.MESSAGES.onlyLikeTypesCanBeCompared(fromEntity.getEntityName(), toEntity.getEntityName());
}
SQLUtil.getSelfCompareWhereClause(fromEntity.getPrimaryKeyFields(), fromAlias, toAlias, buf);
}