Package org.jboss.ejb.plugins.cmp.jdbc.bridge

Examples of org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge


               return buf;
            }
         }

         String alias = aliasManager.getAlias(path.getPath(path.size() - 2));
         JDBCFieldBridge field = (JDBCFieldBridge) path.getField();

         // if jdbc type is null then it should be a cmr field in
         // a one-to-one mapping that isn't a foreign key.
         // handle it the way the IS EMPTY on the one side of one-to-many
         // relationship is handled
         if(field.getJDBCType() == null)
         {
            existsClause(path, buf, !node.not);
            return buf;
         }
View Full Code Here


   public boolean isSelectField()
   {
      boolean result;
      if(selectObject instanceof JDBCFieldBridge)
      {
         JDBCFieldBridge field = (JDBCFieldBridge) selectObject;
         result = field.isCMPField();
      }
      else
      {
         result = false;
      }
View Full Code Here

         path = (ASTPath) child0;

         if(path.isCMPField())
         {
            // set the select object
            JDBCFieldBridge selectField = (JDBCFieldBridge) path.getCMPField();
            selectManager = selectField.getManager();
            selectObject = selectField;
            setTypeFactory(selectManager.getJDBCTypeFactory());

            // todo inner or left?
            //addLeftJoinPath(path);
            addInnerJoinPath(path);

            String alias = aliasManager.getAlias(path.getPath(path.size() - 2));
            SQLUtil.getColumnNamesClause(selectField, alias, sql);
         }
         else
         {
            JDBCAbstractEntityBridge selectEntity = (JDBCAbstractEntityBridge) path.getEntity();
            selectManager = selectEntity.getManager();
            selectObject = selectEntity;
            setTypeFactory(selectEntity.getManager().getJDBCTypeFactory());

            final String alias = aliasManager.getAlias(path.getPath());
            if(select.distinct)
            {
               SQLUtil.getSearchableColumnNamesClause(selectEntity.getTableFields(), alias, sql);
            }
            else
            {
               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
               );
            }
            */

            addLeftJoinPath(path);
         }
      }
      else
      {
         // the function should take a path expresion as a parameter
         path = getPathFromChildren(child0);

         if(path == null)
         {
            throw new IllegalStateException("The function in SELECT clause does not contain a path expression.");
         }

         if(path.isCMPField())
         {
            JDBCFieldBridge selectField = (JDBCFieldBridge) path.getCMPField();
            selectManager = selectField.getManager();
            setTypeFactory(selectManager.getJDBCTypeFactory());
            if(selectField.getJDBCType().hasMapper())
               this.functionJDBCType = selectField.getJDBCType();
         }
         else if(path.isCMRField())
         {
            JDBCFieldBridge cmrField = (JDBCFieldBridge) path.getCMRField();
            selectManager = cmrField.getManager();
            setTypeFactory(selectManager.getJDBCTypeFactory());
            addLeftJoinPath(path);
         }
         else
         {
View Full Code Here

      if(child0 instanceof ASTPath)
      {
         ASTPath path = (ASTPath) child0;
         addLeftJoinPath(path);

         JDBCFieldBridge field = (JDBCFieldBridge) path.getField();

         if(field instanceof JDBCAbstractCMRFieldBridge)
         {
            JDBCAbstractCMRFieldBridge cmrField = (JDBCAbstractCMRFieldBridge)field;
            final String alias;
View Full Code Here

      {
         throw new IllegalStateException("Can only visit cmp valued path node. "
            + "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)
      {
         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 " +
View Full Code Here

                                            StringBuffer buf)
   {
      JDBCAbstractEntityBridge parentEntity = cmrField.getEntity();
      JDBCAbstractEntityBridge childEntity = (JDBCAbstractEntityBridge)cmrField.getRelatedEntity();

      JDBCFieldBridge parentField;
      JDBCFieldBridge childField;

      if(cmrField.hasForeignKey())
      {
         // parent has the foreign keys
         JDBCFieldBridge[] parentFkFields = cmrField.getForeignKeyFields();
         int i = 0;
         while(i < parentFkFields.length)
         {
            parentField = parentFkFields[i++];
            childField = (JDBCFieldBridge)childEntity.getFieldByName(parentField.getFieldName());
            getJoinClause(parentField, parentAlias, childField, childAlias, buf);
            if(i < parentFkFields.length)
               buf.append(AND);
         }
      }
      else
      {
         // child has the foreign keys
         JDBCFieldBridge[] childFkFields = cmrField.getRelatedCMRField().getForeignKeyFields();
         int i = 0;
         while(i < childFkFields.length)
         {
            childField = childFkFields[i++];
            parentField = (JDBCFieldBridge)parentEntity.getFieldByName(childField.getFieldName());

            // add the sql
            getJoinClause(parentField, parentAlias, childField, childAlias, buf);
            if(i < childFkFields.length)
            {
View Full Code Here

                                                         String parentAlias,
                                                         String relationTableAlias,
                                                         StringBuffer buf)
   {
      JDBCAbstractEntityBridge parentEntity = cmrField.getEntity();
      JDBCFieldBridge parentField;
      JDBCFieldBridge relationField;

      // parent to relation table join
      JDBCFieldBridge[] parentFields = cmrField.getTableKeyFields();
      int i = 0;
      while(i < parentFields.length)
      {
         relationField = parentFields[i++];
         parentField = (JDBCFieldBridge)parentEntity.getFieldByName(relationField.getFieldName());
         getJoinClause(parentField, parentAlias, relationField, relationTableAlias, buf);
         if(i < parentFields.length)
            buf.append(AND);
      }
      return buf;
View Full Code Here

               return buf;
            }
         }

         String alias = aliasManager.getAlias(path.getPath(path.size() - 2));
         JDBCFieldBridge field = (JDBCFieldBridge) path.getField();

         // if jdbc type is null then it should be a cmr field in
         // a one-to-one mapping that isn't a foreign key.
         // handle it the way the IS EMPTY on the one side of one-to-many
         // relationship is handled
         if(field.getJDBCType() == null)
         {
            existsClause(path, buf, !node.not);
            return buf;
         }
View Full Code Here

   {
      List parameters = new ArrayList();
      JDBCFieldBridge[] pkFields = entity.getPrimaryKeyFields();
      for(int i = 0; i < pkFields.length; ++i)
      {
         JDBCFieldBridge pkField = pkFields[i];

         JDBCType type = pkField.getJDBCType();
         if(type instanceof JDBCTypeComplex)
         {
            JDBCTypeComplexProperty[] props =
               ((JDBCTypeComplex)type).getProperties();
            for(int j = 0; j < props.length; j++)
View Full Code Here

   {
      List parameters = new ArrayList();
      JDBCFieldBridge[] pkFields = entity.getPrimaryKeyFields();
      for(int i = 0; i < pkFields.length; ++i)
      {
         JDBCFieldBridge pkField = pkFields[i];

         JDBCType type = pkField.getJDBCType();
         if(type instanceof JDBCTypeComplex)
         {
            JDBCTypeComplexProperty[] props = ((JDBCTypeComplex)type).getProperties();
            for(int j = 0; j < props.length; j++)
            {
View Full Code Here

TOP

Related Classes of org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.