// setup the from path
ASTPath fromPath = (ASTPath) node.jjtGetChild(0);
addInnerJoinPath(fromPath);
String fromAlias = aliasManager.getAlias(fromPath.getPath(fromPath.size() - 2));
CMPFieldBridge fromCMPField = (CMPFieldBridge) fromPath.getCMPField();
Node toNode = node.jjtGetChild(1);
if (toNode instanceof ASTParameter) {
ASTParameter toParam = (ASTParameter) toNode;
// can only compare like kind entities
Class parameterType = getParameterType(toParam.number);
if (!(fromCMPField.getFieldType().equals(parameterType))) {
throw new IllegalStateException("Only like types can be " +
"compared: from CMP field=" +
fromCMPField.getFieldType() +
" to parameter=" + parameterType);
}
inputParameters.addAll(QueryParameter.createParameters(toParam.number - 1, fromCMPField));
SQLUtil.getWhereClause(fromCMPField.getJDBCType(), fromAlias, comparison, buf);
} else {
ASTPath toPath = (ASTPath) toNode;
addInnerJoinPath(toPath);
String toAlias = aliasManager.getAlias(toPath.getPath(toPath.size() - 2));
JDBCCMPFieldBridge toCMPField = (JDBCCMPFieldBridge) toPath.getCMPField();
// can only compare like kind entities
if (!(fromCMPField.getFieldType().equals(toCMPField.getFieldType()))) {
throw new IllegalStateException("Only like types can be " +
"compared: from CMP field=" +
fromCMPField.getFieldType() +
" to CMP field=" + toCMPField.getFieldType());
}
SQLUtil.getSelfCompareWhereClause(fromCMPField, toCMPField, fromAlias, toAlias, comparison, buf);
}