[jboss-cvs] JBossAS SVN: r62505 - in branches/JBoss_4_0_5_GA_CP: server/src/main/org/jboss/ejb/plugins/cmp/jdbc and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 24 06:13:03 EDT 2007


Author: darran.lofthouse at jboss.com
Date: 2007-04-24 06:13:03 -0400 (Tue, 24 Apr 2007)
New Revision: 62505

Added:
   branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/enums/test/JDBC2PmEnumUnitTestCase.java
   branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jbas3541/JDBC2PmJBAS3541UnitTestCase.java
   branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/enums/META-INF/jdbc2pm-jboss.xml
   branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/jbas3541/META-INF/jdbc2pm-jboss.xml
Modified:
   branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/bridge/CMPFieldBridge.java
   branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/EJBQLToSQL92Compiler.java
   branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCFieldBridge.java
   branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/bridge/JDBCCMPFieldBridge2.java
   branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/cmp.xml
Log:
ASPATCH-201 - support value classes in EJBQLToSQL92Compiler.

Modified: branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/bridge/CMPFieldBridge.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/bridge/CMPFieldBridge.java	2007-04-24 10:12:27 UTC (rev 62504)
+++ branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/bridge/CMPFieldBridge.java	2007-04-24 10:13:03 UTC (rev 62505)
@@ -1,26 +1,28 @@
 /*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
 package org.jboss.ejb.plugins.cmp.bridge;
 
-public interface CMPFieldBridge extends FieldBridge {
+import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge;
+
+public interface CMPFieldBridge extends JDBCFieldBridge {
    public Class getFieldType();
 }

Modified: branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/EJBQLToSQL92Compiler.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/EJBQLToSQL92Compiler.java	2007-04-24 10:12:27 UTC (rev 62504)
+++ branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/EJBQLToSQL92Compiler.java	2007-04-24 10:13:03 UTC (rev 62505)
@@ -30,7 +30,9 @@
 import java.util.HashMap;
 import java.util.Iterator;
 
+import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge;
 import org.jboss.ejb.plugins.cmp.ejbql.*;
+import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge;
 import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge;
 import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractEntityBridge;
 import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMRFieldBridge;
@@ -48,39 +50,54 @@
  * @author <a href="mailto:alex at jboss.org">Alex Loubyansky</a>
  * @version $Revision$
  */
-public final class EJBQLToSQL92Compiler
-   implements QLCompiler, JBossQLParserVisitor
+public final class EJBQLToSQL92Compiler implements QLCompiler, JBossQLParserVisitor
 {
    private static final Logger log = Logger.getLogger(EJBQLToSQL92Compiler.class);
 
    // input objects
    private final Catalog catalog;
+
    private Class returnType;
+
    private Class[] parameterTypes;
+
    private JDBCReadAheadMetaData readAhead;
 
    // alias info
    private AliasManager aliasManager;
+
    private Map joinPaths = new HashMap();
+
    private Map identifierToTable = new HashMap();
+
    private Set joinedAliases = new HashSet();
 
    // mapping metadata
    private JDBCTypeMappingMetaData typeMapping;
+
    private JDBCTypeFactory typeFactory;
 
    // output objects
    private boolean forceDistinct;
+
    private String sql;
+
    private int offsetParam;
+
    private int offsetValue;
+
    private int limitParam;
+
    private int limitValue;
+
    private JDBCEntityPersistenceStore selectManager;
+
    private Object selectObject;
+
    private List inputParameters = new ArrayList();
 
    private List leftJoinCMRList = new ArrayList();
+
    private StringBuffer onFindCMRJoin;
 
    private boolean countCompositePk;
@@ -91,7 +108,7 @@
    }
 
    public void compileEJBQL(String ejbql, Class returnType, Class[] parameterTypes, JDBCQueryMetaData metadata)
-      throws Exception
+         throws Exception
    {
       // reset all state variables
       reset();
@@ -112,13 +129,13 @@
          // translate to sql
          sql = ejbqlNode.jjtAccept(this, new StringBuffer()).toString();
       }
-      catch(Exception e)
+      catch (Exception e)
       {
          // if there is a problem reset the state before exiting
          reset();
          throw e;
       }
-      catch(Error e)
+      catch (Error e)
       {
          // lame javacc lexer throws Errors
          reset();
@@ -127,7 +144,7 @@
    }
 
    public void compileJBossQL(String ejbql, Class returnType, Class[] parameterTypes, JDBCQueryMetaData metadata)
-      throws Exception
+         throws Exception
    {
       // reset all state variables
       reset();
@@ -148,19 +165,19 @@
          // translate to sql
          sql = ejbqlNode.jjtAccept(this, new StringBuffer()).toString();
 
-         if(log.isTraceEnabled())
+         if (log.isTraceEnabled())
          {
             log.trace("ejbql: " + ejbql);
             log.trace("sql: " + sql);
          }
       }
-      catch(Exception e)
+      catch (Exception e)
       {
          // if there is a problem reset the state before exiting
          reset();
          throw e;
       }
-      catch(Error e)
+      catch (Error e)
       {
          // lame javacc lexer throws Errors
          reset();
@@ -206,7 +223,7 @@
    public boolean isSelectField()
    {
       boolean result;
-      if(selectObject instanceof JDBCFieldBridge)
+      if (selectObject instanceof JDBCFieldBridge)
       {
          JDBCFieldBridge field = (JDBCFieldBridge) selectObject;
          result = field.isCMPField();
@@ -245,8 +262,8 @@
 
    public Object visit(SimpleNode node, Object data)
    {
-      throw new RuntimeException("Internal error: Found unknown node type in " +
-         "EJB-QL abstract syntax tree: node=" + node);
+      throw new RuntimeException("Internal error: Found unknown node type in " + "EJB-QL abstract syntax tree: node="
+            + node);
    }
 
    public Object visit(ASTEJBQL node, Object data)
@@ -260,20 +277,20 @@
 
       StringBuffer whereClause = null;
       StringBuffer orderByClause = null;
-      for(int i = 2; i < node.jjtGetNumChildren(); ++i)
+      for (int i = 2; i < node.jjtGetNumChildren(); ++i)
       {
          Node childNode = node.jjtGetChild(i);
-         if(childNode instanceof ASTWhere)
+         if (childNode instanceof ASTWhere)
          {
             whereClause = new StringBuffer(20);
             childNode.jjtAccept(this, whereClause);
          }
-         else if(childNode instanceof ASTOrderBy)
+         else if (childNode instanceof ASTOrderBy)
          {
             orderByClause = new StringBuffer();
             childNode.jjtAccept(this, orderByClause);
          }
-         else if(childNode instanceof ASTLimitOffset)
+         else if (childNode instanceof ASTLimitOffset)
          {
             childNode.jjtAccept(this, null);
          }
@@ -284,7 +301,7 @@
       fromNode.jjtAccept(this, fromClause);
 
       // left-join
-      for(Iterator iter = identifierToTable.entrySet().iterator(); iter.hasNext();)
+      for (Iterator iter = identifierToTable.entrySet().iterator(); iter.hasNext();)
       {
          final Map.Entry entry = (Map.Entry) iter.next();
          final String identifier = (String) entry.getKey();
@@ -294,7 +311,7 @@
          fromClause.append(table).append(' ').append(alias);
          join(alias, fromClause);
 
-         if(iter.hasNext())
+         if (iter.hasNext())
          {
             fromClause.append(SQLUtil.COMMA);
          }
@@ -302,47 +319,44 @@
 
       // assemble sql
       StringBuffer sql = (StringBuffer) data;
-      if(selectManager.getMetaData().hasRowLocking() && !(selectObject instanceof SelectFunction))
+      if (selectManager.getMetaData().hasRowLocking() && !(selectObject instanceof SelectFunction))
       {
          JDBCFunctionMappingMetaData rowLockingTemplate = typeMapping.getRowLockingTemplate();
-         if(rowLockingTemplate == null)
+         if (rowLockingTemplate == null)
          {
-            throw new IllegalStateException("Row locking template is not defined for given mapping: " + typeMapping.getName());
+            throw new IllegalStateException("Row locking template is not defined for given mapping: "
+                  + typeMapping.getName());
          }
 
          boolean distinct = ((ASTSelect) selectNode).distinct || returnType == Set.class || forceDistinct;
 
-         Object args[] = new Object[]{
-            distinct ? SQLUtil.DISTINCT + selectClause : selectClause.toString(),
-            fromClause,
-            whereClause == null || whereClause.length() == 0 ? null : whereClause,
-            orderByClause == null || orderByClause.length() == 0 ? null : orderByClause
-         };
+         Object args[] = new Object[]
+         {distinct ? SQLUtil.DISTINCT + selectClause : selectClause.toString(), fromClause,
+               whereClause == null || whereClause.length() == 0 ? null : whereClause,
+               orderByClause == null || orderByClause.length() == 0 ? null : orderByClause};
          rowLockingTemplate.getFunctionSql(args, sql);
       }
       else
       {
          sql.append(SQLUtil.SELECT);
-         if(((ASTSelect) selectNode).distinct || returnType == Set.class || forceDistinct)
+         if (((ASTSelect) selectNode).distinct || returnType == Set.class || forceDistinct)
          {
             sql.append(SQLUtil.DISTINCT);
          }
-         sql.append(selectClause)
-            .append(SQLUtil.FROM)
-            .append(fromClause);
+         sql.append(selectClause).append(SQLUtil.FROM).append(fromClause);
 
-         if(whereClause != null && whereClause.length() > 0)
+         if (whereClause != null && whereClause.length() > 0)
          {
             sql.append(SQLUtil.WHERE).append(whereClause);
          }
 
-         if(orderByClause != null && orderByClause.length() > 0)
+         if (orderByClause != null && orderByClause.length() > 0)
          {
             sql.append(SQLUtil.ORDERBY).append(orderByClause);
          }
       }
 
-      if(countCompositePk)
+      if (countCompositePk)
       {
          sql.insert(0, "SELECT COUNT(*) FROM (").append(") t_count");
       }
@@ -354,7 +368,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      for(int i = 1; i < node.jjtGetNumChildren(); i++)
+      for (int i = 1; i < node.jjtGetNumChildren(); i++)
       {
          buf.append(SQLUtil.COMMA);
          node.jjtGetChild(i).jjtAccept(this, data);
@@ -366,7 +380,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      if(node.ascending)
+      if (node.ascending)
       {
          buf.append(SQLUtil.ASC);
       }
@@ -380,14 +394,14 @@
    public Object visit(ASTLimitOffset node, Object data)
    {
       int child = 0;
-      if(node.hasOffset)
+      if (node.hasOffset)
       {
          Node offsetNode = node.jjtGetChild(child++);
-         if(offsetNode instanceof ASTParameter)
+         if (offsetNode instanceof ASTParameter)
          {
             ASTParameter param = (ASTParameter) offsetNode;
             Class parameterType = getParameterType(param.number);
-            if(int.class != parameterType && Integer.class != parameterType)
+            if (int.class != parameterType && Integer.class != parameterType)
             {
                throw new IllegalStateException("OFFSET parameter must be an int");
             }
@@ -400,14 +414,14 @@
          }
       }
 
-      if(node.hasLimit)
+      if (node.hasLimit)
       {
          Node limitNode = node.jjtGetChild(child);
-         if(limitNode instanceof ASTParameter)
+         if (limitNode instanceof ASTParameter)
          {
             ASTParameter param = (ASTParameter) limitNode;
             Class parameterType = getParameterType(param.number);
-            if(int.class != parameterType && Integer.class != parameterType)
+            if (int.class != parameterType && Integer.class != parameterType)
             {
                throw new IllegalStateException("LIMIT parameter must be an int");
             }
@@ -428,11 +442,11 @@
 
       final Node child0 = select.jjtGetChild(0);
       final ASTPath path;
-      if(child0 instanceof ASTPath)
+      if (child0 instanceof ASTPath)
       {
          path = (ASTPath) child0;
 
-         if(path.isCMPField())
+         if (path.isCMPField())
          {
             // set the select object
             JDBCFieldBridge selectField = (JDBCFieldBridge) path.getCMPField();
@@ -455,23 +469,21 @@
             setTypeFactory(selectEntity.getManager().getJDBCTypeFactory());
 
             final String alias = aliasManager.getAlias(path.getPath());
-            SQLUtil.getColumnNamesClause(selectEntity.getTableFields(),
-               alias,
-               sql);
+            SQLUtil.getColumnNamesClause(selectEntity.getTableFields(), alias, sql);
 
             /*
-            if(readAhead.isOnFind())
-            {
-               String eagerLoadGroupName = readAhead.getEagerLoadGroup();
-               boolean[] loadGroupMask = selectEntity.getLoadGroupMask(eagerLoadGroupName);
-               SQLUtil.appendColumnNamesClause(
-                  selectEntity.getTableFields(),
-                  loadGroupMask,
-                  alias,
-                  sql
-               );
-            }
-            */
+             if(readAhead.isOnFind())
+             {
+             String eagerLoadGroupName = readAhead.getEagerLoadGroup();
+             boolean[] loadGroupMask = selectEntity.getLoadGroupMask(eagerLoadGroupName);
+             SQLUtil.appendColumnNamesClause(
+             selectEntity.getTableFields(),
+             loadGroupMask,
+             alias,
+             sql
+             );
+             }
+             */
 
             addLeftJoinPath(path);
          }
@@ -481,18 +493,18 @@
          // the function should take a path expresion as a parameter
          path = getPathFromChildren(child0);
 
-         if(path == null)
+         if (path == null)
          {
             throw new IllegalStateException("The function in SELECT clause does not contain a path expression.");
          }
 
-         if(path.isCMPField())
+         if (path.isCMPField())
          {
             JDBCFieldBridge selectField = (JDBCFieldBridge) path.getCMPField();
             selectManager = selectField.getManager();
             setTypeFactory(selectManager.getJDBCTypeFactory());
          }
-         else if(path.isCMRField())
+         else if (path.isCMRField())
          {
             JDBCFieldBridge cmrField = (JDBCFieldBridge) path.getCMRField();
             selectManager = cmrField.getManager();
@@ -524,7 +536,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      for(int i = 1; i < node.jjtGetNumChildren(); ++i)
+      for (int i = 1; i < node.jjtGetNumChildren(); ++i)
       {
          buf.append(SQLUtil.OR);
          node.jjtGetChild(i).jjtAccept(this, data);
@@ -534,7 +546,7 @@
 
    public Object visit(ASTWhereConditionalTerm node, Object data)
    {
-      for(int i = 0; i < node.jjtGetNumChildren(); ++i)
+      for (int i = 0; i < node.jjtGetNumChildren(); ++i)
       {
          node.jjtGetChild(i).jjtAccept(this, data);
       }
@@ -545,7 +557,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      for(int i = 1; i < node.jjtGetNumChildren(); i++)
+      for (int i = 1; i < node.jjtGetNumChildren(); i++)
       {
          buf.append(SQLUtil.AND);
          node.jjtGetChild(i).jjtAccept(this, data);
@@ -574,7 +586,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      if(node.not)
+      if (node.not)
       {
          buf.append(SQLUtil.NOT);
       }
@@ -589,13 +601,13 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      if(node.not)
+      if (node.not)
       {
          buf.append(SQLUtil.NOT);
       }
       buf.append(SQLUtil.IN).append('(');
       node.jjtGetChild(1).jjtAccept(this, data);
-      for(int i = 2; i < node.jjtGetNumChildren(); i++)
+      for (int i = 2; i < node.jjtGetNumChildren(); i++)
       {
          buf.append(SQLUtil.COMMA);
          node.jjtGetChild(i).jjtAccept(this, data);
@@ -608,13 +620,13 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      if(node.not)
+      if (node.not)
       {
          buf.append(SQLUtil.NOT);
       }
       buf.append(SQLUtil.LIKE);
       node.jjtGetChild(1).jjtAccept(this, data);
-      if(node.jjtGetNumChildren() == 3)
+      if (node.jjtGetNumChildren() == 3)
       {
          buf.append(SQLUtil.ESCAPE);
          node.jjtGetChild(2).jjtAccept(this, data);
@@ -627,20 +639,20 @@
       StringBuffer sql = (StringBuffer) data;
 
       final Node child0 = node.jjtGetChild(0);
-      if(child0 instanceof ASTPath)
+      if (child0 instanceof ASTPath)
       {
          ASTPath path = (ASTPath) child0;
          addLeftJoinPath(path);
 
          JDBCFieldBridge field = (JDBCFieldBridge) path.getField();
 
-         if(field instanceof JDBCAbstractCMRFieldBridge)
+         if (field instanceof JDBCAbstractCMRFieldBridge)
          {
-            JDBCAbstractCMRFieldBridge cmrField = (JDBCAbstractCMRFieldBridge)field;
+            JDBCAbstractCMRFieldBridge cmrField = (JDBCAbstractCMRFieldBridge) field;
             final String alias;
             final JDBCFieldBridge[] keyFields;
 
-            if(cmrField.hasForeignKey())
+            if (cmrField.hasForeignKey())
             {
                alias = aliasManager.getAlias(path.getPath(path.size() - 2));
                keyFields = cmrField.getForeignKeyFields();
@@ -648,7 +660,7 @@
             else
             {
                alias = aliasManager.getAlias(path.getPath());
-               if(cmrField.getMetaData().getRelationMetaData().isTableMappingStyle())
+               if (cmrField.getMetaData().getRelationMetaData().isTableMappingStyle())
                {
                   keyFields = cmrField.getRelatedCMRField().getEntity().getPrimaryKeyFields();
                }
@@ -666,7 +678,7 @@
             SQLUtil.getIsNullClause(node.not, field, alias, sql);
          }
       }
-      else if(child0 instanceof ASTParameter)
+      else if (child0 instanceof ASTParameter)
       {
          ASTParameter param = (ASTParameter) child0;
          Class type = getParameterType(param.number);
@@ -675,7 +687,7 @@
          inputParameters.add(queryParam);
 
          sql.append("? IS ");
-         if(node.not)
+         if (node.not)
          {
             sql.append(SQLUtil.NOT);
          }
@@ -692,7 +704,7 @@
    public Object visit(ASTIsEmpty node, Object data)
    {
       ASTPath path = (ASTPath) node.jjtGetChild(0);
-      if(!path.isCMRField())
+      if (!path.isCMRField())
       {
          throw new IllegalStateException("IS EMPTY can be applied only to collection valued CMR field.");
       }
@@ -716,14 +728,14 @@
 
       StringBuffer sql = (StringBuffer) data;
 
-      if(node.not)
+      if (node.not)
       {
          sql.append(SQLUtil.NOT);
       }
 
       sql.append(SQLUtil.EXISTS).append('(').append(SQLUtil.SELECT);
 
-      if(member instanceof ASTParameter)
+      if (member instanceof ASTParameter)
       {
          ASTParameter toParam = (ASTParameter) member;
          verifyParameterEntityType(toParam.number, colEntity);
@@ -733,13 +745,12 @@
          String localParentAlias = aliasManager.getAlias(colPath.getPath(0) + "_local");
          JDBCAbstractEntityBridge parentEntity = (JDBCAbstractEntityBridge) colPath.getEntity(0);
          SQLUtil.getColumnNamesClause(parentEntity.getPrimaryKeyFields(), localParentAlias, sql);
-         sql.append(SQLUtil.FROM)
-            .append(parentEntity.getQualifiedTableName()).append(' ').append(localParentAlias);
+         sql.append(SQLUtil.FROM).append(parentEntity.getQualifiedTableName()).append(' ').append(localParentAlias);
          innerJoinPath(colPath, sql);
 
          sql.append(SQLUtil.WHERE);
 
-         JDBCAbstractEntityBridge col0 = (JDBCAbstractEntityBridge)colPath.getEntity(0);
+         JDBCAbstractEntityBridge col0 = (JDBCAbstractEntityBridge) colPath.getEntity(0);
          SQLUtil.getSelfCompareWhereClause(col0.getPrimaryKeyFields(), parentAlias, localParentAlias, sql);
          sql.append(SQLUtil.AND);
 
@@ -751,61 +762,51 @@
          ASTPath memberPath = (ASTPath) member;
          JDBCAbstractEntityBridge memberEntity = (JDBCAbstractEntityBridge) memberPath.getEntity();
 
-         if(!memberEntity.equals(colEntity))
+         if (!memberEntity.equals(colEntity))
          {
             throw new IllegalStateException("Member must be if the same type as the collection, got: member="
-               +
-               memberEntity.getEntityName()
-               + ", collection=" + colEntity.getEntityName());
+                  + memberEntity.getEntityName() + ", collection=" + colEntity.getEntityName());
          }
 
          String memberAlias = aliasManager.getAlias(memberPath.getPath());
 
-         if(memberPath.size() > 1)
+         if (memberPath.size() > 1)
          {
             String parentAlias = aliasManager.getAlias(memberPath.getPath(0) + "_local");
             JDBCAbstractEntityBridge parentEntity = (JDBCAbstractEntityBridge) memberPath.getEntity(0);
             SQLUtil.getColumnNamesClause(parentEntity.getPrimaryKeyFields(), parentAlias, sql);
-            sql.append(SQLUtil.FROM)
-               .append(parentEntity.getQualifiedTableName()).append(' ').append(parentAlias);
+            sql.append(SQLUtil.FROM).append(parentEntity.getQualifiedTableName()).append(' ').append(parentAlias);
             innerJoinPath(memberPath, sql);
             innerJoinPath(colPath, sql);
          }
-         else if(colPath.size() > 1)
+         else if (colPath.size() > 1)
          {
             String parentAlias = aliasManager.getAlias(colPath.getPath(0) + "_local");
             JDBCAbstractEntityBridge parentEntity = (JDBCAbstractEntityBridge) colPath.getEntity(0);
             SQLUtil.getColumnNamesClause(parentEntity.getPrimaryKeyFields(), parentAlias, sql);
-            sql.append(SQLUtil.FROM)
-               .append(parentEntity.getQualifiedTableName()).append(' ').append(parentAlias);
+            sql.append(SQLUtil.FROM).append(parentEntity.getQualifiedTableName()).append(' ').append(parentAlias);
             innerJoinPath(colPath, sql);
          }
          else
          {
             throw new IllegalStateException(
-               "There should be collection valued path expression, not identification variable.");
+                  "There should be collection valued path expression, not identification variable.");
          }
 
          sql.append(SQLUtil.WHERE);
 
-         JDBCAbstractEntityBridge member0 = (JDBCAbstractEntityBridge)memberPath.getEntity(0);
+         JDBCAbstractEntityBridge member0 = (JDBCAbstractEntityBridge) memberPath.getEntity(0);
          String colAliasLocal = aliasManager.getAlias(colPath.getPath() + "_local");
-         if(memberPath.size() > 1)
+         if (memberPath.size() > 1)
          {
             String memberAliasLocal = aliasManager.getAlias(memberPath.getPath() + "_local");
-            SQLUtil.getSelfCompareWhereClause(colEntity.getPrimaryKeyFields(),
-               memberAliasLocal,
-               colAliasLocal,
-               sql);
+            SQLUtil.getSelfCompareWhereClause(colEntity.getPrimaryKeyFields(), memberAliasLocal, colAliasLocal, sql);
 
             sql.append(SQLUtil.AND);
 
             String member0Alias = aliasManager.getAlias(memberPath.getPath(0));
             String member0AliasLocal = aliasManager.getAlias(memberPath.getPath(0) + "_local");
-            SQLUtil.getSelfCompareWhereClause(member0.getPrimaryKeyFields(),
-               member0Alias,
-               member0AliasLocal,
-               sql);
+            SQLUtil.getSelfCompareWhereClause(member0.getPrimaryKeyFields(), member0Alias, member0AliasLocal, sql);
          }
          else
          {
@@ -820,14 +821,14 @@
 
    private void innerJoinPath(ASTPath path, StringBuffer sql)
    {
-      if(path.size() < 2)
+      if (path.size() < 2)
       {
          return;
       }
 
       String parentAlias = aliasManager.getAlias(path.getPath(0) + "_local");
       String leftAlias = parentAlias;
-      for(int i = 1; i < path.size(); ++i)
+      for (int i = 1; i < path.size(); ++i)
       {
          String curPath = path.getPath(i);
          final String joinAlias = aliasManager.getAlias(curPath + "_local");
@@ -839,30 +840,18 @@
 
          String join = " INNER JOIN ";
 
-         if(relation.isTableMappingStyle())
+         if (relation.isTableMappingStyle())
          {
             String relTableAlias = aliasManager.getRelationTableAlias(curPath + "_local");
-            sql.append(join)
-               .append(cmrField.getQualifiedTableName())
-               .append(' ')
-               .append(relTableAlias)
-               .append(" ON ");
+            sql.append(join).append(cmrField.getQualifiedTableName()).append(' ').append(relTableAlias).append(" ON ");
             SQLUtil.getRelationTableJoinClause(cmrField, leftAlias, relTableAlias, sql);
 
-            sql.append(join)
-               .append(joinEntity.getQualifiedTableName())
-               .append(' ')
-               .append(joinAlias)
-               .append(" ON ");
+            sql.append(join).append(joinEntity.getQualifiedTableName()).append(' ').append(joinAlias).append(" ON ");
             SQLUtil.getRelationTableJoinClause(cmrField.getRelatedCMRField(), joinAlias, relTableAlias, sql);
          }
          else
          {
-            sql.append(join)
-               .append(joinEntity.getQualifiedTableName())
-               .append(' ')
-               .append(joinAlias)
-               .append(" ON ");
+            sql.append(join).append(joinEntity.getQualifiedTableName()).append(' ').append(joinAlias).append(" ON ");
 
             SQLUtil.getJoinClause(cmrField, leftAlias, joinAlias, sql);
          }
@@ -884,7 +873,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      if(node.jjtGetNumChildren() == 2)
+      if (node.jjtGetNumChildren() == 2)
       {
          buf.append(' ').append(node.opp).append(' ');
          node.jjtGetChild(1).jjtAccept(this, data);
@@ -903,7 +892,58 @@
 
    public Object visit(ASTValueClassComparison node, Object data)
    {
-      throw new IllegalStateException("Value class comparison is not yet supported.");
+      StringBuffer buf = (StringBuffer) data;
+
+      boolean not = (node.opp.equals(SQLUtil.NOT_EQUAL));
+      String comparison = node.opp;
+      buf.append('(');
+      if (not)
+      {
+         buf.append(SQLUtil.NOT).append('(');
+         comparison = "=";
+      }
+
+      // setup the from path
+      ASTPath fromPath = (ASTPath) node.jjtGetChild(0);
+      System.out.println("fromPath: " + fromPath.getPath());
+      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);
+      }
+
+      return (not ? buf.append(')') : buf).append(')');
    }
 
    public Object visit(ASTEntityComparison node, Object data)
@@ -911,7 +951,7 @@
       StringBuffer buf = (StringBuffer) data;
       Node arg0 = node.jjtGetChild(0);
       Node arg1 = node.jjtGetChild(1);
-      if(node.opp.equals(SQLUtil.NOT_EQUAL))
+      if (node.opp.equals(SQLUtil.NOT_EQUAL))
       {
          compareEntity(true, arg0, arg1, buf);
       }
@@ -935,7 +975,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      for(int i = 1; i < node.jjtGetNumChildren(); i++)
+      for (int i = 1; i < node.jjtGetNumChildren(); i++)
       {
          buf.append(' ').append(node.opps.get(i - 1)).append(' ');
          node.jjtGetChild(i).jjtAccept(this, data);
@@ -947,7 +987,7 @@
    {
       StringBuffer buf = (StringBuffer) data;
       node.jjtGetChild(0).jjtAccept(this, data);
-      for(int i = 1; i < node.jjtGetNumChildren(); i++)
+      for (int i = 1; i < node.jjtGetNumChildren(); i++)
       {
          buf.append(' ').append(node.opps.get(i - 1)).append(' ');
          node.jjtGetChild(i).jjtAccept(this, data);
@@ -1033,7 +1073,7 @@
       Object[] args = new Object[3];
       args[0] = node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString();
       args[1] = node.jjtGetChild(1).jjtAccept(this, new StringBuffer()).toString();
-      if(node.jjtGetNumChildren() == 3)
+      if (node.jjtGetNumChildren() == 3)
       {
          args[2] = node.jjtGetChild(2).jjtAccept(this, new StringBuffer()).toString();
       }
@@ -1076,10 +1116,8 @@
    {
       node.setResultType(returnType);
       StringBuffer buf = (StringBuffer) data;
-      Object[] args = new Object[]{
-         node.distinct,
-         node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),
-      };
+      Object[] args = new Object[]
+      {node.distinct, node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),};
       JDBCTypeMappingMetaData.AVG_FUNC.getFunctionSql(args, buf);
       return data;
    }
@@ -1088,10 +1126,8 @@
    {
       node.setResultType(returnType);
       StringBuffer buf = (StringBuffer) data;
-      Object[] args = new Object[]{
-         node.distinct,
-         node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),
-      };
+      Object[] args = new Object[]
+      {node.distinct, node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),};
       JDBCTypeMappingMetaData.MAX_FUNC.getFunctionSql(args, buf);
       return data;
    }
@@ -1100,10 +1136,8 @@
    {
       node.setResultType(returnType);
       StringBuffer buf = (StringBuffer) data;
-      Object[] args = new Object[]{
-         node.distinct,
-         node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),
-      };
+      Object[] args = new Object[]
+      {node.distinct, node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),};
       JDBCTypeMappingMetaData.MIN_FUNC.getFunctionSql(args, buf);
       return data;
    }
@@ -1112,10 +1146,8 @@
    {
       node.setResultType(returnType);
       StringBuffer buf = (StringBuffer) data;
-      Object[] args = new Object[]{
-         node.distinct,
-         node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),
-      };
+      Object[] args = new Object[]
+      {node.distinct, node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString(),};
       JDBCTypeMappingMetaData.SUM_FUNC.getFunctionSql(args, buf);
       return data;
    }
@@ -1127,15 +1159,16 @@
 
       Object args[];
       final ASTPath cntPath = (ASTPath) node.jjtGetChild(0);
-      if(cntPath.isCMPField())
+      if (cntPath.isCMPField())
       {
-         args = new Object[]{node.distinct, node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString()};
+         args = new Object[]
+         {node.distinct, node.jjtGetChild(0).jjtAccept(this, new StringBuffer()).toString()};
       }
       else
       {
          JDBCAbstractEntityBridge entity = (JDBCAbstractEntityBridge) cntPath.getEntity();
          final JDBCFieldBridge[] pkFields = entity.getPrimaryKeyFields();
-         if(pkFields.length > 1)
+         if (pkFields.length > 1)
          {
             countCompositePk = true;
             forceDistinct = node.distinct.length() > 0;
@@ -1143,9 +1176,7 @@
             addLeftJoinPath(cntPath);
 
             String alias = aliasManager.getAlias(cntPath.getPath());
-            SQLUtil.getColumnNamesClause(entity.getPrimaryKeyFields(),
-               alias,
-               buf);
+            SQLUtil.getColumnNamesClause(entity.getPrimaryKeyFields(), alias, buf);
 
             return buf;
          }
@@ -1154,7 +1185,8 @@
             final String alias = aliasManager.getAlias(cntPath.getPath());
             StringBuffer keyColumn = new StringBuffer(20);
             SQLUtil.getColumnNamesClause(pkFields[0], alias, keyColumn);
-            args = new Object[]{node.distinct, keyColumn.toString()};
+            args = new Object[]
+            {node.distinct, keyColumn.toString()};
          }
       }
 
@@ -1165,24 +1197,29 @@
    public Object visit(ASTPath node, Object data)
    {
       StringBuffer buf = (StringBuffer) data;
-      if(!node.isCMPField())
+      if (!node.isCMPField())
       {
          throw new IllegalStateException("Can only visit cmp valued path node. "
-            + "Should have been handled at a higher level.");
+               + "Should have been handled at a higher level.");
       }
 
+      JDBCFieldBridge cmpField = (JDBCFieldBridge) node.getCMPField();
+
       // make sure this is mapped to a single column
-      switch(node.type)
+      switch (node.type)
       {
-         case EJBQLTypes.ENTITY_TYPE:
-         case EJBQLTypes.VALUE_CLASS_TYPE:
-         case EJBQLTypes.UNKNOWN_TYPE:
-            throw new IllegalStateException("Can not visit multi-column path " +
-               "node. Should have been handled at a higher level.");
+         case EJBQLTypes.ENTITY_TYPE :
+         case EJBQLTypes.VALUE_CLASS_TYPE :
+            if (cmpField.getJDBCType().hasMapper() || cmpField.getJDBCType().getParameterSetter() != null)
+            {
+               break;
+            }
+         case EJBQLTypes.UNKNOWN_TYPE :
+            throw new IllegalStateException("Can not visit multi-column path "
+                  + "node. Should have been handled at a higher level.");
       }
 
       addLeftJoinPath(node);
-      JDBCFieldBridge cmpField = (JDBCFieldBridge) node.getCMPField();
       String alias = aliasManager.getAlias(node.getPath(node.size() - 2));
       SQLUtil.getColumnNamesClause(cmpField, alias, buf);
       return data;
@@ -1191,7 +1228,7 @@
    public Object visit(ASTAbstractSchema node, Object data)
    {
       throw new IllegalStateException("Can not visit abstract schema node. "
-         + " Should have been handled at a higher level.");
+            + " Should have been handled at a higher level.");
    }
 
    public Object visit(ASTIdentifier node, Object data)
@@ -1206,13 +1243,11 @@
 
       // make sure this is mapped to a single column
       int ejbqlType = EJBQLTypes.getEJBQLType(type);
-      if(ejbqlType == EJBQLTypes.ENTITY_TYPE
-         ||
-         ejbqlType == EJBQLTypes.VALUE_CLASS_TYPE ||
-         ejbqlType == EJBQLTypes.UNKNOWN_TYPE)
+      if (ejbqlType == EJBQLTypes.ENTITY_TYPE || ejbqlType == EJBQLTypes.VALUE_CLASS_TYPE
+            || ejbqlType == EJBQLTypes.UNKNOWN_TYPE)
       {
-         throw new IllegalStateException("Can not visit multi-column " +
-            "parameter node. Should have been handled at a higher level.");
+         throw new IllegalStateException("Can not visit multi-column "
+               + "parameter node. Should have been handled at a higher level.");
       }
 
       QueryParameter param = new QueryParameter(node.number - 1, typeFactory.getJDBCType(type));
@@ -1246,7 +1281,7 @@
    public Object visit(ASTBooleanLiteral node, Object data)
    {
       StringBuffer buf = (StringBuffer) data;
-      if(node.value)
+      if (node.value)
       {
          buf.append(typeMapping.getTrueMapping());
       }
@@ -1261,7 +1296,7 @@
    {
       StringBuffer sql = (StringBuffer) data;
       from.jjtGetChild(0).jjtAccept(this, data);
-      for(int i = 1; i < from.jjtGetNumChildren(); ++i)
+      for (int i = 1; i < from.jjtGetNumChildren(); ++i)
       {
          from.jjtGetChild(i).jjtAccept(this, data);
       }
@@ -1297,7 +1332,7 @@
    private void compareEntity(boolean not, Node fromNode, Node toNode, StringBuffer buf)
    {
       buf.append('(');
-      if(not)
+      if (not)
       {
          buf.append(SQLUtil.NOT).append('(');
       }
@@ -1307,7 +1342,7 @@
       String fromAlias = aliasManager.getAlias(fromPath.getPath());
       JDBCAbstractEntityBridge fromEntity = (JDBCAbstractEntityBridge) fromPath.getEntity();
 
-      if(toNode instanceof ASTParameter)
+      if (toNode instanceof ASTParameter)
       {
          ASTParameter toParam = (ASTParameter) toNode;
 
@@ -1326,20 +1361,16 @@
          JDBCAbstractEntityBridge toEntity = (JDBCAbstractEntityBridge) toPath.getEntity();
 
          // can only compare like kind entities
-         if(!fromEntity.equals(toEntity))
+         if (!fromEntity.equals(toEntity))
          {
-            throw new IllegalStateException("Only like types can be "
-               +
-               "compared: from entity="
-               +
-               fromEntity.getEntityName()
-               + " to entity=" + toEntity.getEntityName());
+            throw new IllegalStateException("Only like types can be " + "compared: from entity="
+                  + fromEntity.getEntityName() + " to entity=" + toEntity.getEntityName());
          }
 
          SQLUtil.getSelfCompareWhereClause(fromEntity.getPrimaryKeyFields(), fromAlias, toAlias, buf);
       }
 
-      if(not)
+      if (not)
       {
          buf.append(')');
       }
@@ -1349,23 +1380,23 @@
    private void join(String alias, StringBuffer sql)
    {
       Map paths = (Map) joinPaths.get(alias);
-      if(paths == null || paths.isEmpty())
+      if (paths == null || paths.isEmpty())
       {
          return;
       }
 
-      for(Iterator iter = paths.values().iterator(); iter.hasNext();)
+      for (Iterator iter = paths.values().iterator(); iter.hasNext();)
       {
          String leftAlias = alias;
          ASTPath path = (ASTPath) iter.next();
-         for(int i = 1; i < path.size(); ++i)
+         for (int i = 1; i < path.size(); ++i)
          {
-            if(path.isCMRField(i))
+            if (path.isCMRField(i))
             {
                final String curPath = path.getPath(i);
                final String joinAlias = aliasManager.getAlias(curPath);
 
-               if(joinedAliases.add(joinAlias))
+               if (joinedAliases.add(joinAlias))
                {
                   final JDBCAbstractCMRFieldBridge cmrField = (JDBCAbstractCMRFieldBridge) path.getCMRField(i);
                   final JDBCAbstractEntityBridge joinEntity = (JDBCAbstractEntityBridge) cmrField.getRelatedEntity();
@@ -1374,30 +1405,21 @@
 
                   String join = (path.innerJoin ? " INNER JOIN " : " LEFT OUTER JOIN ");
 
-                  if(relation.isTableMappingStyle())
+                  if (relation.isTableMappingStyle())
                   {
                      String relTableAlias = aliasManager.getRelationTableAlias(curPath);
-                     sql.append(join)
-                        .append(cmrField.getQualifiedTableName())
-                        .append(' ')
-                        .append(relTableAlias)
-                        .append(" ON ");
+                     sql.append(join).append(cmrField.getQualifiedTableName()).append(' ').append(relTableAlias)
+                           .append(" ON ");
                      SQLUtil.getRelationTableJoinClause(cmrField, leftAlias, relTableAlias, sql);
 
-                     sql.append(join)
-                        .append(joinEntity.getQualifiedTableName())
-                        .append(' ')
-                        .append(joinAlias)
-                        .append(" ON ");
+                     sql.append(join).append(joinEntity.getQualifiedTableName()).append(' ').append(joinAlias).append(
+                           " ON ");
                      SQLUtil.getRelationTableJoinClause(cmrField.getRelatedCMRField(), joinAlias, relTableAlias, sql);
                   }
                   else
                   {
-                     sql.append(join)
-                        .append(joinEntity.getQualifiedTableName())
-                        .append(' ')
-                        .append(joinAlias)
-                        .append(" ON ");
+                     sql.append(join).append(joinEntity.getQualifiedTableName()).append(' ').append(joinAlias).append(
+                           " ON ");
 
                      SQLUtil.getJoinClause(cmrField, leftAlias, joinAlias, sql);
                   }
@@ -1417,19 +1439,19 @@
 
    private void addLeftJoinPath(ASTPath path)
    {
-      if(path.size() > 1 && path.isCMRField(1))
+      if (path.size() > 1 && path.isCMRField(1))
       {
          final String identifier = path.getPath(0);
          final String alias = aliasManager.getAlias(identifier);
          Map paths = (Map) joinPaths.get(alias);
-         if(paths == null)
+         if (paths == null)
          {
             paths = new HashMap();
             joinPaths.put(alias, paths);
          }
 
          ASTPath oldPath = (ASTPath) paths.put(path, path);
-         if(oldPath != null && oldPath.innerJoin)
+         if (oldPath != null && oldPath.innerJoin)
          {
             path.innerJoin = true;
          }
@@ -1438,12 +1460,12 @@
 
    private void addInnerJoinPath(ASTPath path)
    {
-      if(path.size() > 1 && path.isCMRField(1))
+      if (path.size() > 1 && path.isCMRField(1))
       {
          final String identifier = path.getPath(0);
          final String alias = aliasManager.getAlias(identifier);
          Map paths = (Map) joinPaths.get(alias);
-         if(paths == null)
+         if (paths == null)
          {
             paths = new HashMap();
             joinPaths.put(alias, paths);
@@ -1457,7 +1479,7 @@
    private Object[] childrenToStringArr(int numChildren, Node node)
    {
       Object[] args = new Object[numChildren];
-      for(int i = 0; i < numChildren; ++i)
+      for (int i = 0; i < numChildren; ++i)
       {
          args[i] = node.jjtGetChild(i).jjtAccept(this, new StringBuffer()).toString();
       }
@@ -1472,17 +1494,17 @@
     */
    private ASTPath getPathFromChildren(Node selectFunction)
    {
-      for(int childInd = 0; childInd < selectFunction.jjtGetNumChildren(); ++childInd)
+      for (int childInd = 0; childInd < selectFunction.jjtGetNumChildren(); ++childInd)
       {
          Node child = selectFunction.jjtGetChild(childInd);
-         if(child instanceof ASTPath)
+         if (child instanceof ASTPath)
          {
             return (ASTPath) child;
          }
-         else if(child instanceof SelectFunction)
+         else if (child instanceof SelectFunction)
          {
             Node path = getPathFromChildren(child);
-            if(path != null)
+            if (path != null)
             {
                return (ASTPath) path;
             }
@@ -1495,16 +1517,15 @@
    {
       this.typeFactory = typeFactory;
       this.typeMapping = typeFactory.getTypeMapping();
-      aliasManager = new AliasManager(typeMapping.getAliasHeaderPrefix(),
-         typeMapping.getAliasHeaderSuffix(),
-         typeMapping.getAliasMaxLength());
+      aliasManager = new AliasManager(typeMapping.getAliasHeaderPrefix(), typeMapping.getAliasHeaderSuffix(),
+            typeMapping.getAliasMaxLength());
    }
 
    private Class getParameterType(int index)
    {
       int zeroBasedIndex = index - 1;
       Class[] params = parameterTypes;
-      if(zeroBasedIndex < params.length)
+      if (zeroBasedIndex < params.length)
       {
          return params[zeroBasedIndex];
       }
@@ -1517,11 +1538,11 @@
       Class parameterType = getParameterType(number);
       Class remoteClass = entity.getRemoteInterface();
       Class localClass = entity.getLocalInterface();
-      if((localClass == null || !localClass.isAssignableFrom(parameterType)) &&
-         (remoteClass == null || !remoteClass.isAssignableFrom(parameterType)))
+      if ((localClass == null || !localClass.isAssignableFrom(parameterType))
+            && (remoteClass == null || !remoteClass.isAssignableFrom(parameterType)))
       {
-         throw new IllegalStateException("Only like types can be compared: from entity=" +
-            entity.getEntityName() + " to parameter type=" + parameterType);
+         throw new IllegalStateException("Only like types can be compared: from entity=" + entity.getEntityName()
+               + " to parameter type=" + parameterType);
       }
    }
 

Modified: branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCFieldBridge.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCFieldBridge.java	2007-04-24 10:12:27 UTC (rev 62504)
+++ branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCFieldBridge.java	2007-04-24 10:13:03 UTC (rev 62505)
@@ -1,24 +1,24 @@
 /*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
 package org.jboss.ejb.plugins.cmp.jdbc.bridge;
 
 import java.sql.PreparedStatement;

Modified: branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/bridge/JDBCCMPFieldBridge2.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/bridge/JDBCCMPFieldBridge2.java	2007-04-24 10:12:27 UTC (rev 62504)
+++ branches/JBoss_4_0_5_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/bridge/JDBCCMPFieldBridge2.java	2007-04-24 10:13:03 UTC (rev 62505)
@@ -1,24 +1,24 @@
 /*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
 package org.jboss.ejb.plugins.cmp.jdbc2.bridge;
 
 import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge;
@@ -28,7 +28,6 @@
 import org.jboss.ejb.plugins.cmp.jdbc.JDBCType;
 import org.jboss.ejb.plugins.cmp.jdbc.JDBCEntityPersistenceStore;
 import org.jboss.ejb.plugins.cmp.jdbc.JDBCResultSetReader;
-import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge;
 import org.jboss.ejb.EntityEnterpriseContext;
 import org.jboss.deployment.DeploymentException;
 import org.jboss.logging.Logger;
@@ -44,7 +43,7 @@
  * @version <tt>$Revision$</tt>
  */
 public class JDBCCMPFieldBridge2
-   implements CMPFieldBridge, JDBCFieldBridge
+   implements CMPFieldBridge
 {
    private final JDBCEntityBridge2 entity;
    private final int rowIndex;

Modified: branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/cmp.xml
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/cmp.xml	2007-04-24 10:12:27 UTC (rev 62504)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/imports/sections/cmp.xml	2007-04-24 10:13:03 UTC (rev 62505)
@@ -322,6 +322,28 @@
          <zipfileset src="${junit.junit.lib}/junit.jar"
             includes="junit/**/*.*"/>
       </jar>
+      <copy file="${build.resources}/cmp2/jbas3541/META-INF/jboss.xml"
+         tofile="${build.resources}/cmp2/jbas3541/META-INF/original-jboss.xml"/>
+      <copy file="${build.resources}/cmp2/jbas3541/META-INF/jdbc2pm-jboss.xml"
+         tofile="${build.resources}/cmp2/jbas3541/META-INF/jboss.xml"
+         overwrite="true"/>
+      <jar jarfile="${build.lib}/cmp2-jdbc2pm-jbas3541.jar">
+         <fileset dir="${build.classes}">
+            <patternset refid="common.test.client.classes"/>
+            <include name="org/jboss/test/cmp2/jbas3541/**"/>
+         </fileset>
+         <fileset dir="${build.resources}/cmp2/jbas3541">
+            <include name="**/*.*"/>
+         </fileset>
+         <zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
+            includes="net/**/*.*"/>
+         <zipfileset src="${junit.junit.lib}/junit.jar"
+            includes="junit/**/*.*"/>
+      </jar>
+      <copy
+         file="${build.resources}/cmp2/jbas3541/META-INF/original-jboss.xml"
+         tofile="${build.resources}/cmp2/jbas3541/META-INF/jboss.xml"
+         overwrite="true"/>
 
       <!-- build cmp2-jbas979.jar -->
       <jar destfile="${build.lib}/cmp2-jbas979.jar">
@@ -408,7 +430,29 @@
             <patternset refid="ejbrunner.set"/>
          </zipfileset>
       </jar>
-      
+      <copy file="${build.resources}/cmp2/enums/META-INF/jboss.xml"
+         tofile="${build.resources}/cmp2/enums/META-INF/original-jboss.xml"/>
+      <copy file="${build.resources}/cmp2/enums/META-INF/jdbc2pm-jboss.xml"
+         tofile="${build.resources}/cmp2/enums/META-INF/jboss.xml"
+         overwrite="true"/>
+      <jar jarfile="${build.lib}/cmp2-jdbc2pm-enum.jar">
+         <fileset dir="${build.classes}">
+            <patternset refid="common.test.client.classes"/>
+            <include name="org/jboss/test/cmp2/enums/**"/>
+         </fileset>
+         <fileset dir="${build.resources}/cmp2/enums">
+            <include name="**/*.*"/>
+         </fileset>
+         <zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
+            includes="net/**/*.*"/>
+         <zipfileset src="${junit.junit.lib}/junit.jar"
+            includes="junit/**/*.*"/>
+      </jar>
+      <copy
+         file="${build.resources}/cmp2/enums/META-INF/original-jboss.xml"
+         tofile="${build.resources}/cmp2/enums/META-INF/jboss.xml"
+         overwrite="true"/>
+
       <!-- build cmp2-cmrtansaction.jar -->
       <jar destfile="${build.lib}/cmp2-cmrtransaction.jar">
          <fileset dir="${build.classes}">

Copied: branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/enums/test/JDBC2PmEnumUnitTestCase.java (from rev 59594, branches/Branch_4_0/testsuite/src/main/org/jboss/test/cmp2/enums/test/JDBC2PmEnumUnitTestCase.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/enums/test/JDBC2PmEnumUnitTestCase.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/enums/test/JDBC2PmEnumUnitTestCase.java	2007-04-24 10:13:03 UTC (rev 62505)
@@ -0,0 +1,43 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test.cmp2.enums.test;
+
+import junit.framework.Test;
+import org.jboss.test.JBossTestCase;
+
+/**
+ *
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ */
+public class JDBC2PmEnumUnitTestCase
+   extends EnumUnitTestCase
+{
+   public static Test suite() throws Exception
+   {
+      return JBossTestCase.getDeploySetup(JDBC2PmEnumUnitTestCase.class, "cmp2-jdbc2pm-enum.jar");
+   }
+
+   public JDBC2PmEnumUnitTestCase(String s)
+   {
+      super(s);
+   }
+}

Copied: branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jbas3541/JDBC2PmJBAS3541UnitTestCase.java (from rev 59594, branches/Branch_4_0/testsuite/src/main/org/jboss/test/cmp2/jbas3541/JDBC2PmJBAS3541UnitTestCase.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jbas3541/JDBC2PmJBAS3541UnitTestCase.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jbas3541/JDBC2PmJBAS3541UnitTestCase.java	2007-04-24 10:13:03 UTC (rev 62505)
@@ -0,0 +1,43 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test.cmp2.jbas3541;
+
+import org.jboss.test.JBossTestCase;
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 44174 $</tt>
+ */
+public class JDBC2PmJBAS3541UnitTestCase
+   extends JBAS3541UnitTestCase
+{
+   public static Test suite() throws Exception
+   {
+      return JBossTestCase.getDeploySetup(JDBC2PmJBAS3541UnitTestCase.class, "cmp2-jdbc2pm-jbas3541.jar");
+   }
+
+   public JDBC2PmJBAS3541UnitTestCase(String methodName)
+   {
+      super(methodName);
+   }
+}

Copied: branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/enums/META-INF/jdbc2pm-jboss.xml (from rev 59594, branches/Branch_4_0/testsuite/src/resources/cmp2/enums/META-INF/jdbc2pm-jboss.xml)
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/enums/META-INF/jdbc2pm-jboss.xml	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/enums/META-INF/jdbc2pm-jboss.xml	2007-04-24 10:13:03 UTC (rev 62505)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
+
+<jboss>
+
+   <enterprise-beans>
+
+      <entity>
+         <ejb-name>Child</ejb-name>
+         <local-jndi-name>ChildLocal</local-jndi-name>
+         <configuration-name>cmp2.x jdbc2 pm</configuration-name>
+      </entity>
+
+      <session>
+         <ejb-name>Facade</ejb-name>
+         <jndi-name>Facade</jndi-name>
+      </session>
+      <session>
+         <ejb-name>EJBTestRunnerEJB</ejb-name>
+         <jndi-name>ejb/EJBTestRunner</jndi-name>
+      </session>
+
+   </enterprise-beans>
+
+</jboss>

Copied: branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/jbas3541/META-INF/jdbc2pm-jboss.xml (from rev 59594, branches/Branch_4_0/testsuite/src/resources/cmp2/jbas3541/META-INF/jdbc2pm-jboss.xml)
===================================================================
--- branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/jbas3541/META-INF/jdbc2pm-jboss.xml	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP/testsuite/src/resources/cmp2/jbas3541/META-INF/jdbc2pm-jboss.xml	2007-04-24 10:13:03 UTC (rev 62505)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<jboss>
+   <enterprise-beans>
+      <entity>
+         <ejb-name>A</ejb-name>
+         <local-jndi-name>ALocal</local-jndi-name>
+         <configuration-name>cmp2.x jdbc2 pm</configuration-name>
+      </entity>
+      <session>
+         <ejb-name>EJBTestRunnerEJB</ejb-name>
+         <jndi-name>ejb/EJBTestRunner</jndi-name>
+      </session>
+   </enterprise-beans>
+</jboss>




More information about the jboss-cvs-commits mailing list