Examples of JDBCCMPFieldBridge


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

            {
               // main entity; load the values into the context
               loadIter.reset();
               while(loadIter.hasNext())
               {
                  JDBCCMPFieldBridge field = loadIter.next();
                  index = field.loadInstanceResults(rs, index, ctx);
                  field.setClean(ctx);
               }
               mainEntityLoaded = true;
            }
            else
            {
               // preload entity; load the values into the read ahead cahce
               loadIter.reset();
               while(loadIter.hasNext())
               {
                  JDBCCMPFieldBridge field = loadIter.next();
                  // ref must be reset to null before load
                  ref[0] = null;

                  // load the result of the field
                  index = field.loadArgumentResults(rs, index, ref);

                  // cache the field value
                  readAheadCache.addPreloadData(pk, field, ref[0]);
               }
            }
View Full Code Here

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

/*     */     {
/*  94 */       lockedIterator = this.entity.getLockedIterator(ctx);
/*  95 */       while (lockedIterator.hasNext())
/*     */       {
/*  97 */         sql.append(" AND ");
/*  98 */         JDBCCMPFieldBridge field = lockedIterator.next();
/*  99 */         if (field.getLockedValue(ctx) == null)
/*     */         {
/* 101 */           SQLUtil.getIsNullClause(false, field, "", sql);
/* 102 */           lockedIterator.remove();
/*     */         }
/*     */         else
/*     */         {
/* 106 */           SQLUtil.getWhereClause(field, sql);
/*     */         }
/*     */       }
/*     */     }
/*     */
/* 111 */     Connection con = null;
/* 112 */     PreparedStatement ps = null;
/* 113 */     int rowsAffected = 0;
/*     */     try
/*     */     {
/* 117 */       if (this.log.isDebugEnabled())
/*     */       {
/* 119 */         this.log.debug("Executing SQL: " + sql);
/*     */       }
/*     */
/* 123 */       con = this.entity.getDataSource().getConnection();
/* 124 */       ps = con.prepareStatement(sql.toString());
/*     */
/* 127 */       int index = 1;
/* 128 */       dirtyIterator.reset();
/* 129 */       while (dirtyIterator.hasNext())
/*     */       {
/* 131 */         index = dirtyIterator.next().setInstanceParameters(ps, index, ctx);
/*     */       }
/*     */
/* 135 */       index = this.entity.setPrimaryKeyParameters(ps, index, ctx.getId());
/*     */
/* 138 */       if (hasLockedFields)
/*     */       {
/* 140 */         lockedIterator.reset();
/* 141 */         while (lockedIterator.hasNext())
/*     */         {
/* 143 */           JDBCCMPFieldBridge field = lockedIterator.next();
/* 144 */           Object value = field.getLockedValue(ctx);
/* 145 */           index = field.setArgumentParameters(ps, index, value);
/*     */         }
/*     */
/*     */       }
/*     */
/* 150 */       rowsAffected = ps.executeUpdate();
View Full Code Here

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

/*      */     else
/*      */     {
/*  959 */       ASTPath toPath = (ASTPath)toNode;
/*  960 */       addInnerJoinPath(toPath);
/*  961 */       String toAlias = this.aliasManager.getAlias(toPath.getPath(toPath.size() - 2));
/*  962 */       JDBCCMPFieldBridge toCMPField = (JDBCCMPFieldBridge)toPath.getCMPField();
/*      */
/*  965 */       if (!fromCMPField.getFieldType().equals(toCMPField.getFieldType()))
/*      */       {
/*  967 */         throw new IllegalStateException("Only like types can be compared: from CMP field=" + fromCMPField.getFieldType() + " to CMP field=" + toCMPField.getFieldType());
/*      */       }
/*      */
/*  973 */       SQLUtil.getSelfCompareWhereClause(fromCMPField, toCMPField, fromAlias, toAlias, comparison, buf);
/*      */     }
/*      */
View Full Code Here

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

/*      */     {
/* 1023 */       ASTPath path = (ASTPath)child0;
/*      */
/* 1025 */       if (path.isCMPField())
/*      */       {
/* 1028 */         JDBCCMPFieldBridge selectField = (JDBCCMPFieldBridge)path.getCMPField();
/* 1029 */         this.selectManager = ((JDBCStoreManager)selectField.getManager());
/* 1030 */         this.selectObject = selectField;
/* 1031 */         setTypeFactory(this.selectManager.getJDBCTypeFactory());
/*      */
/* 1033 */         addJoinPath(path);
/* 1034 */         this.selectAlias = this.aliasManager.getAlias(path.getPath(path.size() - 2));
/* 1035 */         SQLUtil.getColumnNamesClause(selectField, this.selectAlias, buf);
/*      */       }
/*      */       else
/*      */       {
/* 1040 */         JDBCEntityBridge selectEntity = (JDBCEntityBridge)path.getEntity();
/* 1041 */         this.selectManager = ((JDBCStoreManager)selectEntity.getManager());
/* 1042 */         this.selectObject = selectEntity;
/* 1043 */         setTypeFactory(this.selectManager.getJDBCTypeFactory());
/* 1044 */         selectEntity(path, node.distinct, buf);
/*      */       }
/*      */
/*      */     }
/*      */     else
/*      */     {
/* 1050 */       ASTPath path = getPathFromChildren(child0);
/*      */
/* 1052 */       if (path == null)
/*      */       {
/* 1054 */         throw new IllegalStateException("The function in SELECT clause does not contain a path expression.");
/*      */       }
/*      */
/* 1057 */       if (path.isCMPField())
/*      */       {
/* 1059 */         JDBCCMPFieldBridge selectField = (JDBCCMPFieldBridge)path.getCMPField();
/* 1060 */         this.selectManager = ((JDBCStoreManager)selectField.getManager());
/*      */       }
/* 1062 */       else if (path.isCMRField())
/*      */       {
/* 1064 */         JDBCCMRFieldBridge cmrField = (JDBCCMRFieldBridge)path.getCMRField();
/* 1065 */         this.selectManager = ((JDBCStoreManager)cmrField.getEntity().getManager());
View Full Code Here

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

/*      */     }
/*      */
/* 1342 */     ASTPath fromPath = (ASTPath)node.jjtGetChild(0);
/* 1343 */     addJoinPath(fromPath);
/* 1344 */     String fromAlias = this.aliasManager.getAlias(fromPath.getPath(fromPath.size() - 2));
/* 1345 */     JDBCCMPFieldBridge fromCMPField = (JDBCCMPFieldBridge)fromPath.getCMPField();
/*      */
/* 1347 */     Node toNode = node.jjtGetChild(1);
/* 1348 */     if ((toNode instanceof ASTParameter))
/*      */     {
/* 1350 */       ASTParameter toParam = (ASTParameter)toNode;
/*      */
/* 1353 */       Class parameterType = getParameterType(toParam.number);
/* 1354 */       if (!fromCMPField.getFieldType().equals(parameterType))
/*      */       {
/* 1356 */         throw new IllegalStateException("Only like types can be compared: from CMP field=" + fromCMPField.getFieldType() + " to parameter=" + parameterType);
/*      */       }
/*      */
/* 1362 */       this.inputParameters.addAll(QueryParameter.createParameters(toParam.number - 1, fromCMPField));
/* 1363 */       SQLUtil.getWhereClause(fromCMPField.getJDBCType(), fromAlias, comparison, buf);
/*      */     }
/*      */     else
/*      */     {
/* 1367 */       ASTPath toPath = (ASTPath)toNode;
/* 1368 */       addJoinPath(toPath);
/* 1369 */       String toAlias = this.aliasManager.getAlias(toPath.getPath(toPath.size() - 2));
/* 1370 */       JDBCCMPFieldBridge toCMPField = (JDBCCMPFieldBridge)toPath.getCMPField();
/*      */
/* 1373 */       if (!fromCMPField.getFieldType().equals(toCMPField.getFieldType()))
/*      */       {
/* 1375 */         throw new IllegalStateException("Only like types can be compared: from CMP field=" + fromCMPField.getFieldType() + " to CMP field=" + toCMPField.getFieldType());
/*      */       }
/*      */
/* 1381 */       SQLUtil.getSelfCompareWhereClause(fromCMPField, toCMPField, fromAlias, toAlias, comparison, buf);
/*      */     }
/*      */
View Full Code Here

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

/* 1632 */     if (!node.isCMPField())
/*      */     {
/* 1634 */       throw new IllegalStateException("Can only visit cmp valued path node. Should have been handled at a higher level.");
/*      */     }
/*      */
/* 1638 */     JDBCCMPFieldBridge cmpField = (JDBCCMPFieldBridge)node.getCMPField();
/*      */
/* 1641 */     switch (node.type)
/*      */     {
/*      */     case 5:
/*      */     case 6:
/* 1645 */       if ((cmpField.getJDBCType().hasMapper()) || (cmpField.getJDBCType().getParameterSetter() != null))
/*      */       {
/*      */         break;
/*      */       }
/*      */
/*      */     case -1:
View Full Code Here

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

/*     */
/* 119 */     int offset = toInt(parameters, compiler.getOffsetParam(), compiler.getOffsetValue());
/* 120 */     int limit = toInt(parameters, compiler.getLimitParam(), compiler.getLimitValue());
/*     */
/* 122 */     JDBCEntityBridge selectEntity = null;
/* 123 */     JDBCCMPFieldBridge selectField = null;
/* 124 */     SelectFunction selectFunction = null;
/* 125 */     if (compiler.isSelectEntity())
/*     */     {
/* 127 */       selectEntity = (JDBCEntityBridge)compiler.getSelectEntity();
/*     */     }
View Full Code Here

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

/* 366 */         value = null;
/*     */       }
/*     */
/* 369 */       if ((field instanceof JDBCCMPFieldBridge))
/*     */       {
/* 371 */         JDBCCMPFieldBridge cmpField = (JDBCCMPFieldBridge)field;
/*     */
/* 373 */         if (!cmpField.isLoaded(ctx))
/*     */         {
/* 375 */           if (this.log.isTraceEnabled())
/*     */           {
/* 377 */             this.log.trace("Preloading data: entity=" + this.manager.getEntityBridge().getEntityName() + " pk=" + ctx.getId() + " cmpField=" + cmpField.getFieldName());
/*     */           }
/*     */
/* 384 */           cmpField.setInstanceValue(ctx, value);
/*     */
/* 387 */           cmpField.setClean(ctx);
/*     */
/* 389 */           loaded = true;
/*     */         }
/* 393 */         else if (this.log.isTraceEnabled())
/*     */         {
/* 395 */           this.log.trace("CMPField already loaded: entity=" + this.manager.getEntityBridge().getEntityName() + " pk=" + ctx.getId() + " cmpField=" + cmpField.getFieldName());
/*     */         }
/*     */
/*     */       }
/* 402 */       else if ((field instanceof JDBCCMRFieldBridge))
/*     */       {
View Full Code Here

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

/*     */   }
/*     */
/*     */   protected JDBCCMPFieldBridge getGeneratedPKField()
/*     */     throws DeploymentException
/*     */   {
/* 169 */     JDBCCMPFieldBridge pkField = null;
/* 170 */     JDBCFieldBridge[] pkFields = this.entity.getPrimaryKeyFields();
/* 171 */     for (int i = 0; i < pkFields.length; i++)
/*     */     {
/* 173 */       if (pkField != null)
/* 174 */         throw new DeploymentException("Generation only supported with single PK field");
View Full Code Here

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

/*     */     {
/* 106 */       setSelectEntity(entity);
/*     */     }
/*     */     else
/*     */     {
/* 110 */       JDBCCMPFieldBridge field = entity.getCMPFieldByName(fieldName);
/* 111 */       if (field == null)
/*     */       {
/* 113 */         throw new DeploymentException("Unknown cmp field: " + fieldName);
/*     */       }
/* 115 */       setSelectField(field);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.