/* */
/* */ public Object visit(ASTMemberOf node, Object data)
/* */ {
/* 729 */ Node member = node.jjtGetChild(0);
/* 730 */ ASTPath colPath = (ASTPath)node.jjtGetChild(1);
/* 731 */ JDBCAbstractEntityBridge colEntity = (JDBCAbstractEntityBridge)colPath.getEntity();
/* */
/* 733 */ StringBuffer sql = (StringBuffer)data;
/* */
/* 735 */ if (node.not)
/* */ {
/* 737 */ sql.append(" NOT ");
/* */ }
/* */
/* 740 */ sql.append("EXISTS ").append('(').append("SELECT ");
/* */
/* 742 */ if ((member instanceof ASTParameter))
/* */ {
/* 744 */ ASTParameter toParam = (ASTParameter)member;
/* 745 */ verifyParameterEntityType(toParam.number, colEntity);
/* 746 */ this.inputParameters.addAll(QueryParameter.createParameters(toParam.number - 1, colEntity));
/* */
/* 748 */ String parentAlias = this.aliasManager.getAlias(colPath.getPath(0));
/* 749 */ String localParentAlias = this.aliasManager.getAlias(colPath.getPath(0) + "_local");
/* 750 */ JDBCAbstractEntityBridge parentEntity = (JDBCAbstractEntityBridge)colPath.getEntity(0);
/* 751 */ SQLUtil.getColumnNamesClause(parentEntity.getPrimaryKeyFields(), localParentAlias, sql);
/* 752 */ sql.append(" FROM ").append(parentEntity.getQualifiedTableName()).append(' ').append(localParentAlias);
/* */
/* 754 */ innerJoinPath(colPath, sql);
/* */
/* 756 */ sql.append(" WHERE ");
/* */
/* 758 */ JDBCAbstractEntityBridge col0 = (JDBCAbstractEntityBridge)colPath.getEntity(0);
/* 759 */ SQLUtil.getSelfCompareWhereClause(col0.getPrimaryKeyFields(), parentAlias, localParentAlias, sql);
/* 760 */ sql.append(" AND ");
/* */
/* 762 */ String localColAlias = this.aliasManager.getAlias(colPath.getPath() + "_local");
/* 763 */ SQLUtil.getWhereClause(colEntity.getPrimaryKeyFields(), localColAlias, sql);
/* */ }
/* */ else
/* */ {
/* 767 */ ASTPath memberPath = (ASTPath)member;
/* 768 */ JDBCAbstractEntityBridge memberEntity = (JDBCAbstractEntityBridge)memberPath.getEntity();
/* */
/* 770 */ if (!memberEntity.equals(colEntity))
/* */ {
/* 772 */ throw new IllegalStateException("Member must be if the same type as the collection, got: member=" + memberEntity.getEntityName() + ", collection=" + colEntity.getEntityName());
/* */ }
/* */
/* 778 */ String memberAlias = this.aliasManager.getAlias(memberPath.getPath());
/* */
/* 780 */ if (memberPath.size() > 1)
/* */ {
/* 782 */ String parentAlias = this.aliasManager.getAlias(memberPath.getPath(0) + "_local");
/* 783 */ JDBCAbstractEntityBridge parentEntity = (JDBCAbstractEntityBridge)memberPath.getEntity(0);
/* 784 */ SQLUtil.getColumnNamesClause(parentEntity.getPrimaryKeyFields(), parentAlias, sql);
/* 785 */ sql.append(" FROM ").append(parentEntity.getQualifiedTableName()).append(' ').append(parentAlias);
/* */
/* 787 */ innerJoinPath(memberPath, sql);
/* 788 */ innerJoinPath(colPath, sql);
/* */ }
/* 790 */ else if (colPath.size() > 1)
/* */ {
/* 792 */ String parentAlias = this.aliasManager.getAlias(colPath.getPath(0) + "_local");
/* 793 */ JDBCAbstractEntityBridge parentEntity = (JDBCAbstractEntityBridge)colPath.getEntity(0);
/* 794 */ SQLUtil.getColumnNamesClause(parentEntity.getPrimaryKeyFields(), parentAlias, sql);
/* 795 */ sql.append(" FROM ").append(parentEntity.getQualifiedTableName()).append(' ').append(parentAlias);
/* */
/* 797 */ innerJoinPath(colPath, sql);
/* */ }
/* */ else
/* */ {
/* 801 */ throw new IllegalStateException("There should be collection valued path expression, not identification variable.");
/* */ }
/* */
/* 805 */ sql.append(" WHERE ");
/* */
/* 807 */ JDBCAbstractEntityBridge member0 = (JDBCAbstractEntityBridge)memberPath.getEntity(0);
/* 808 */ String colAliasLocal = this.aliasManager.getAlias(colPath.getPath() + "_local");
/* 809 */ if (memberPath.size() > 1)
/* */ {
/* 811 */ String memberAliasLocal = this.aliasManager.getAlias(memberPath.getPath() + "_local");
/* 812 */ SQLUtil.getSelfCompareWhereClause(colEntity.getPrimaryKeyFields(), memberAliasLocal, colAliasLocal, sql);
/* */
/* 817 */ sql.append(" AND ");
/* */
/* 819 */ String member0Alias = this.aliasManager.getAlias(memberPath.getPath(0));
/* 820 */ String member0AliasLocal = this.aliasManager.getAlias(memberPath.getPath(0) + "_local");
/* 821 */ SQLUtil.getSelfCompareWhereClause(member0.getPrimaryKeyFields(), member0Alias, member0AliasLocal, sql);
/* */ }
/* */ else
/* */ {
/* 828 */ SQLUtil.getSelfCompareWhereClause(member0.getPrimaryKeyFields(), memberAlias, colAliasLocal, sql);
/* */ }
/* */ }
/* */
/* 832 */ sql.append(')');
/* */