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

Examples of org.jboss.ejb.plugins.cmp.jdbc2.bridge.JDBCEntityBridge2


/*  998 */       JDBCCMPFieldBridge2[] tableFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])EntityTable.this.entity.getTableFields();
/*      */
/* 1002 */       int rsOffset = 1;
/* 1003 */       for (int i = 0; i < tableFields.length; i++)
/*      */       {
/* 1005 */         JDBCCMPFieldBridge2 field = tableFields[i];
/* 1006 */         if ((searchableOnly) && (!field.getJDBCType().isSearchable()))
/*      */         {
/* 1008 */           row.fields[field.getRowIndex()] = EntityTable.access$1300();
/* 1009 */           rsOffset--;
/*      */         }
/*      */         else
/*      */         {
/* 1013 */           Object columnValue = field.loadArgumentResults(rs, field.getRowIndex() + rsOffset);
/* 1014 */           row.fields[field.getRowIndex()] = columnValue;
/*      */
/* 1016 */           if (field.getVersionIndex() == -1)
/*      */             continue;
/* 1018 */           row.fields[field.getVersionIndex()] = columnValue;
/*      */         }
/*      */       }
/*      */
/* 1022 */       Object[] relations = EntityTable.this.relationsTotal > 0 ? new Object[EntityTable.this.relationsTotal] : null;
/*      */       try
View Full Code Here


/* 1039 */       Object pk = null;
/* 1040 */       JDBCCMPFieldBridge2[] pkFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])EntityTable.this.entity.getPrimaryKeyFields();
/*      */
/* 1042 */       for (int i = 0; i < pkFields.length; i++)
/*      */       {
/* 1044 */         JDBCCMPFieldBridge2 field = pkFields[i];
/*      */
/* 1046 */         Object columnValue = field.loadArgumentResults(rs, field.getRowIndex() + 1);
/* 1047 */         pk = field.setPrimaryKeyValue(pk, columnValue);
/*      */       }
/* 1049 */       return pk;
/*      */     }
View Full Code Here

/*      */             }
/*      */
/* 1361 */             int paramInd = 1;
/* 1362 */             for (int fInd = 0; fInd < pkFields.length; fInd++)
/*      */             {
/* 1364 */               JDBCCMPFieldBridge2 pkField = pkFields[fInd];
/* 1365 */               Object fieldValue = row.fields[pkField.getRowIndex()];
/* 1366 */               paramInd = pkField.setArgumentParameters(s, paramInd, fieldValue);
/*      */             }
/*      */
/* 1369 */             int affected = s.executeUpdate();
/* 1370 */             if (affected == 1)
/*      */               continue;
View Full Code Here

/*  782 */         Row row = view.created;
/*      */
/*  784 */         int paramInd = 1;
/*  785 */         for (int fInd = 0; fInd < tableFields.length; fInd++)
/*      */         {
/*  787 */           JDBCCMPFieldBridge2 field = tableFields[fInd];
/*  788 */           Object fieldValue = row.fields[field.getRowIndex()];
/*  789 */           paramInd = field.setArgumentParameters(ps, paramInd, fieldValue);
/*      */         }
/*      */
/*  792 */         this.insertStrategy.executeUpdate(ps);
/*      */
/*  794 */         batchCount++;
View Full Code Here

/*      */
/* 1713 */         int paramInd = 1;
/* 1714 */         JDBCCMPFieldBridge2[] tableFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])EntityTable.this.entity.getTableFields();
/* 1715 */         for (int fInd = 0; fInd < tableFields.length; fInd++)
/*      */         {
/* 1717 */           JDBCCMPFieldBridge2 field = tableFields[fInd];
/* 1718 */           Object fieldValue = this.fields[field.getRowIndex()];
/* 1719 */           paramInd = field.setArgumentParameters(insertPs, paramInd, fieldValue);
/*      */         }
/*      */
/* 1722 */         insertPs.executeUpdate();
/*      */
/* 1724 */         flushStatus();
View Full Code Here

/*      */       }
/*      */     }
/*      */
/*      */     private Object loadField(int i)
/*      */     {
/* 1742 */       JDBCCMPFieldBridge2 field = (JDBCCMPFieldBridge2)EntityTable.this.entity.getFields().get(i);
/*      */
/* 1744 */       StringBuffer query = new StringBuffer();
/* 1745 */       query.append("select ").append(field.getColumnName()).append(" from ").append(EntityTable.this.tableName).append(" where ");
/*      */
/* 1751 */       JDBCCMPFieldBridge2[] pkFields = (JDBCCMPFieldBridge2[])(JDBCCMPFieldBridge2[])EntityTable.this.entity.getPrimaryKeyFields();
/* 1752 */       for (int pkI = 0; pkI < pkFields.length; pkI++)
/*      */       {
/* 1754 */         if (pkI > 0)
/*      */         {
/* 1756 */           query.append(" and ");
/*      */         }
/* 1758 */         query.append(pkFields[pkI].getColumnName()).append("=?");
/*      */       }
/*      */
/* 1761 */       if (EntityTable.this.log.isDebugEnabled())
/*      */       {
/* 1763 */         EntityTable.this.log.debug("executing: " + query.toString());
/*      */       }
/*      */
/* 1766 */       Object value = null;
/* 1767 */       Connection con = null;
/* 1768 */       PreparedStatement ps = null;
/* 1769 */       ResultSet rs = null;
/*      */       try
/*      */       {
/* 1773 */         con = EntityTable.this.dataSource.getConnection();
/* 1774 */         ps = con.prepareStatement(query.toString());
/*      */
/* 1776 */         for (int pkI = 0; pkI < pkFields.length; pkI++)
/*      */         {
/* 1778 */           JDBCCMPFieldBridge2 pkField = pkFields[pkI];
/* 1779 */           Object fieldValue = this.fields[pkField.getRowIndex()];
/* 1780 */           pkField.setArgumentParameters(ps, pkI + 1, fieldValue);
/*      */         }
/*      */
/* 1783 */         rs = ps.executeQuery();
/*      */
/* 1785 */         if (!rs.next())
View Full Code Here

      org.jboss.ejb.plugins.cmp.jdbc.bridge.CMRMessage msg = ((CMRInvocation)mi).getCmrMessage();

      // We are going to work with the context a lot
      EntityEnterpriseContext ctx = (EntityEnterpriseContext)mi.getEnterpriseContext();
      JDBCCMRFieldBridge2 cmrField = (JDBCCMRFieldBridge2)mi.getArguments()[0];

      if(org.jboss.ejb.plugins.cmp.jdbc.bridge.CMRMessage.ADD_RELATION == msg)
      {
         Object relatedId = mi.getArguments()[1];
         if(log.isTraceEnabled())
         {
            log.trace("Add relation: field=" + cmrField.getFieldName() +
               " id=" + ctx.getId() +
               " relatedId=" + relatedId);
         }

         cmrField.addRelatedId(ctx, relatedId);
      }
      else if(org.jboss.ejb.plugins.cmp.jdbc.bridge.CMRMessage.REMOVE_RELATION == msg)
      {
         // call removeRelation
         Object relatedId = mi.getArguments()[1];
         if(log.isTraceEnabled())
         {
            log.trace("Remove relation: field=" + cmrField.getFieldName() +
               " id=" + ctx.getId() +
               " relatedId=" + relatedId);
         }

         cmrField.removeRelatedId(ctx, relatedId);
      }
      else
      {
         // this should not be possible we are using a type safe enum
         throw new EJBException("Unknown cmp2.0-relationship-message=" + msg);
View Full Code Here

/*     */     }
/*     */
/*  70 */     CMRMessage msg = ((CMRInvocation)mi).getCmrMessage();
/*     */
/*  73 */     EntityEnterpriseContext ctx = (EntityEnterpriseContext)mi.getEnterpriseContext();
/*  74 */     JDBCCMRFieldBridge2 cmrField = (JDBCCMRFieldBridge2)mi.getArguments()[0];
/*     */
/*  76 */     if (CMRMessage.ADD_RELATION == msg)
/*     */     {
/*  78 */       Object relatedId = mi.getArguments()[1];
/*  79 */       if (this.log.isTraceEnabled())
/*     */       {
/*  81 */         this.log.trace("Add relation: field=" + cmrField.getFieldName() + " id=" + ctx.getId() + " relatedId=" + relatedId);
/*     */       }
/*     */
/*  86 */       cmrField.addRelatedId(ctx, relatedId);
/*     */     }
/*  88 */     else if (CMRMessage.REMOVE_RELATION == msg)
/*     */     {
/*  91 */       Object relatedId = mi.getArguments()[1];
/*  92 */       if (this.log.isTraceEnabled())
/*     */       {
/*  94 */         this.log.trace("Remove relation: field=" + cmrField.getFieldName() + " id=" + ctx.getId() + " relatedId=" + relatedId);
/*     */       }
/*     */
/*  99 */       cmrField.removeRelatedId(ctx, relatedId);
/*     */     }
/*     */     else
/*     */     {
/* 104 */       throw new EJBException("Unknown cmp2.0-relationship-message=" + msg);
/*     */     }
View Full Code Here

      typeFactory = new JDBCTypeFactory(metaData.getTypeMapping(),
         metaData.getJDBCApplication().getValueClasses(),
         metaData.getJDBCApplication().getUserTypeMappings()
      );

      entityBridge = new JDBCEntityBridge2(this, metaData);
      entityBridge.init();

      Catalog catalog = getCatalog();
      catalog.addEntity(entityBridge);
View Full Code Here

      typeFactory = new JDBCTypeFactory(metaData.getTypeMapping(),
         metaData.getJDBCApplication().getValueClasses(),
         metaData.getJDBCApplication().getUserTypeMappings()
      );

      entityBridge = new JDBCEntityBridge2(this, metaData);
      entityBridge.init();

      Catalog catalog = getCatalog();
      catalog.addEntity(entityBridge);
View Full Code Here

TOP

Related Classes of org.jboss.ejb.plugins.cmp.jdbc2.bridge.JDBCEntityBridge2

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.