Package org.jboss.ejb.plugins.cmp.jdbc2

Examples of org.jboss.ejb.plugins.cmp.jdbc2.DeclaredSQLQueryCommand


            Row row = view.deleted;

            int paramInd = 1;
            for(int pkInd = 0; pkInd < pkFields.length; ++pkInd)
            {
               JDBCCMPFieldBridge2 pkField = pkFields[pkInd];
               Object fieldValue = row.fields[pkField.getRowIndex()];
               paramInd = pkField.setArgumentParameters(ps, paramInd, fieldValue);
            }

            deleteStrategy.executeUpdate(ps);

            ++batchCount;
View Full Code Here


            Row row = view.dirty;

            int paramInd = 1;
            for(int fInd = 0; fInd < tableFields.length; ++fInd)
            {
               JDBCCMPFieldBridge2 field = tableFields[fInd];
               if(!field.isPrimaryKeyMember())
               {
                  Object fieldValue = row.fields[field.getRowIndex()];
                  paramInd = field.setArgumentParameters(ps, paramInd, fieldValue);
               }
            }

            for(int fInd = 0; fInd < pkFields.length; ++fInd)
            {
               JDBCCMPFieldBridge2 pkField = pkFields[fInd];
               Object fieldValue = row.fields[pkField.getRowIndex()];
               paramInd = pkField.setArgumentParameters(ps, paramInd, fieldValue);
            }

            JDBCCMPFieldBridge2 versionField = entity.getVersionField();
            if(versionField != null)
            {
               int versionIndex = versionField.getVersionIndex();
               Object curVersion = row.fields[versionIndex];
               paramInd = versionField.setArgumentParameters(ps, paramInd, curVersion);

               Object newVersion = row.fields[versionField.getRowIndex()];
               row.fields[versionIndex] = newVersion;
            }

            updateStrategy.executeUpdate(ps);
View Full Code Here

            Row row = view.created;

            int paramInd = 1;
            for(int fInd = 0; fInd < tableFields.length; ++fInd)
            {
               JDBCCMPFieldBridge2 field = tableFields[fInd];
               Object fieldValue = row.fields[field.getRowIndex()];
               paramInd = field.setArgumentParameters(ps, paramInd, fieldValue);
            }

            insertStrategy.executeUpdate(ps);

            ++batchCount;
View Full Code Here

         created = row;
         row.state = CREATED;

         rowByPk.put(row.pk, row);

         JDBCCMPFieldBridge2 versionField = entity.getVersionField();
         if(versionField != null)
         {
            row.fields[versionField.getVersionIndex()] = row.fields[versionField.getRowIndex()];
         }
      }
View Full Code Here

         // but since tableIndex and rowIndex of a field are the same
         // this should work ok
         int rsOffset = 1;
         for(int i = 0; i < tableFields.length; ++i)
         {
            JDBCCMPFieldBridge2 field = tableFields[i];
            if(searchableOnly && !field.getJDBCType().isSearchable())
            {
               row.fields[field.getRowIndex()] = NOT_LOADED;
               --rsOffset;
               continue;
            }

            Object columnValue = field.loadArgumentResults(rs, field.getRowIndex() + rsOffset);
            row.fields[field.getRowIndex()] = columnValue;

            if(field.getVersionIndex() != -1)
            {
               row.fields[field.getVersionIndex()] = columnValue;
            }
         }

         Object[] relations = (relationsTotal > 0 ? new Object[relationsTotal] : null);
View Full Code Here

         Object pk = null;
         JDBCCMPFieldBridge2[] pkFields = (JDBCCMPFieldBridge2[]) entity.getPrimaryKeyFields();
         //int rsInd = 1;
         for(int i = 0; i < pkFields.length; ++i)
         {
            JDBCCMPFieldBridge2 field = pkFields[i];
            //Object columnValue = field.loadArgumentResults(rs, rsInd++);
            Object columnValue = field.loadArgumentResults(rs, field.getRowIndex() + 1);
            pk = field.setPrimaryKeyValue(pk, columnValue);
         }
         return pk;
      }
View Full Code Here

                  }

                  int paramInd = 1;
                  for (int fInd = 0; fInd < pkFields.length; ++fInd)
                  {
                     JDBCCMPFieldBridge2 pkField = pkFields[fInd];
                     Object fieldValue = row.fields[pkField.getRowIndex()];
                     paramInd = pkField.setArgumentParameters(s, paramInd, fieldValue);
                  }

                  final int affected = s.executeUpdate();
                  if (affected != 1)
                  {
View Full Code Here

/*     */
/* 194 */         int paramInd = 1;
/* 195 */         JDBCCMPFieldBridge2[] keyFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])this.leftField.getTableKeyFields();
/* 196 */         for (int pkInd = 0; pkInd < keyFields.length; pkInd++)
/*     */         {
/* 198 */           JDBCCMPFieldBridge2 pkField = keyFields[pkInd];
/* 199 */           Object fieldValue = pkField.getPrimaryKeyValue(keys.leftKey);
/* 200 */           paramInd = pkField.setArgumentParameters(ps, paramInd, fieldValue);
/*     */         }
/*     */
/* 203 */         keyFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])this.rightField.getTableKeyFields();
/* 204 */         for (int pkInd = 0; pkInd < keyFields.length; pkInd++)
/*     */         {
/* 206 */           JDBCCMPFieldBridge2 pkField = keyFields[pkInd];
/* 207 */           Object fieldValue = pkField.getPrimaryKeyValue(keys.rightKey);
/* 208 */           paramInd = pkField.setArgumentParameters(ps, paramInd, fieldValue);
/*     */         }
/*     */
/* 211 */         ps.addBatch();
/* 212 */         batchCount++;
/*     */
View Full Code Here

/*     */
/* 269 */         JDBCCMPFieldBridge2[] keyFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])this.leftField.getTableKeyFields();
/* 270 */         int paramInd = 1;
/* 271 */         for (int fInd = 0; fInd < keyFields.length; fInd++)
/*     */         {
/* 273 */           JDBCCMPFieldBridge2 field = keyFields[fInd];
/* 274 */           Object fieldValue = field.getPrimaryKeyValue(keys.leftKey);
/* 275 */           paramInd = field.setArgumentParameters(ps, paramInd, fieldValue);
/*     */         }
/*     */
/* 278 */         keyFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])this.rightField.getTableKeyFields();
/* 279 */         for (int fInd = 0; fInd < keyFields.length; fInd++)
/*     */         {
/* 281 */           JDBCCMPFieldBridge2 field = keyFields[fInd];
/* 282 */           Object fieldValue = field.getPrimaryKeyValue(keys.rightKey);
/* 283 */           paramInd = field.setArgumentParameters(ps, paramInd, fieldValue);
/*     */         }
/*     */
/* 286 */         ps.addBatch();
/* 287 */         batchCount++;
/*     */
View Full Code Here

/*      */
/*  285 */     this.updateSql = ("update " + this.tableName + " set ");
/*  286 */     int setFields = 0;
/*  287 */     for (int i = 0; i < tableFields.length; i++)
/*      */     {
/*  289 */       JDBCCMPFieldBridge2 field = tableFields[i];
/*  290 */       if (field.isPrimaryKeyMember())
/*      */         continue;
/*  292 */       if (setFields++ > 0)
/*      */       {
/*  294 */         this.updateSql += ", ";
/*      */       }
/*  296 */       this.updateSql = (this.updateSql + field.getColumnName() + "=?");
/*      */     }
/*      */
/*  299 */     this.updateSql += " where ";
/*  300 */     this.updateSql = (this.updateSql + pkFields[0].getColumnName() + "=?");
/*  301 */     for (int i = 1; i < pkFields.length; i++)
/*      */     {
/*  303 */       this.updateSql = (this.updateSql + " and " + pkFields[i].getColumnName() + "=?");
/*      */     }
/*      */
/*  306 */     if (this.entity.getVersionField() != null)
/*      */     {
/*  308 */       this.updateSql = (this.updateSql + " and " + this.entity.getVersionField().getColumnName() + "=?");
/*      */     }
/*  310 */     this.log.debug("update sql: " + this.updateSql);
/*      */
/*  313 */     String selectColumns = tableFields[0].getColumnName();
/*  314 */     for (int i = 1; i < tableFields.length; i++)
/*      */     {
/*  316 */       JDBCCMPFieldBridge2 field = tableFields[i];
/*  317 */       selectColumns = selectColumns + ", " + field.getColumnName();
/*      */     }
/*      */
/*  320 */     String whereColumns = pkFields[0].getColumnName() + "=?";
/*  321 */     for (int i = 1; i < pkFields.length; i++)
/*      */     {
View Full Code Here

TOP

Related Classes of org.jboss.ejb.plugins.cmp.jdbc2.DeclaredSQLQueryCommand

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.