Ejemplo n.º 1
0
  private void loadCMPFields(JDBCEntityMetaData metadata) {
    // only non pk fields are stored here at first and then later
    // the pk fields are added to the front (makes sql easier to read)
    List<JDBCCMPFieldMetaData> cmpFieldsMD = metadata.getCMPFields();
    List<JDBCCMPFieldBridge> cmpFieldsList = new ArrayList<JDBCCMPFieldBridge>();
    // primary key cmp fields
    List<JDBCCMPFieldBridge> pkFieldsList = new ArrayList<JDBCCMPFieldBridge>();

    // create pk fields
    for (JDBCCMPFieldMetaData fieldMD : cmpFieldsMD) {
      if (fieldMD.isPrimaryKeyMember()) {
        pkFieldsList.add(createCMPField(metadata, fieldMD));
      }
    }
    for (JDBCCMPFieldMetaData fieldMD : cmpFieldsMD) {
      if (!fieldMD.isPrimaryKeyMember()) {
        cmpFieldsList.add(createCMPField(metadata, fieldMD));
      }
    }

    // save the pk fields in the pk field array
    primaryKeyFields = pkFieldsList.toArray(new JDBCCMPFieldBridge[pkFieldsList.size()]);
    // add the pk fields to the front of the cmp list, per guarantee above
    cmpFields = cmpFieldsList.toArray(new JDBCCMPFieldBridge[cmpFieldsList.size()]);
  }
Ejemplo n.º 2
0
  public JDBCCMPFieldBridge2(
      JDBCStoreManager2 manager,
      JDBCEntityBridge2 entity,
      JDBCCMPFieldMetaData metadata,
      int rowIndex) {
    this.rowIndex = rowIndex;
    this.entity = entity;
    jdbcType = manager.getJDBCTypeFactory().getJDBCType(metadata);
    pkClass = metadata.getEntity().getPrimaryKeyClass();
    pkField = metadata.getPrimaryKeyField();
    isPrimaryKeyMember = metadata.isPrimaryKeyMember();
    fieldName = metadata.getFieldName();
    fieldType = metadata.getFieldType();
    cmpFieldIAmMappedTo = null;
    columnName = metadata.getColumnName();

    log =
        Logger.getLogger(
            this.getClass().getName() + "." + entity.getEntityName() + "#" + getFieldName());
  }