protected static Object getObjectUsingNondurableIdForResult(
      final Result result,
      final AbstractClassMetaData cmd,
      final ExecutionContext ec,
      boolean ignoreCache,
      final int[] fpMembers,
      String tableName,
      StoreManager storeMgr,
      Table table) {
    if (cmd.hasDiscriminatorStrategy()) {
      // Check the class for this discriminator value
      String familyName = HBaseUtils.getFamilyNameForColumn(table.getDiscriminatorColumn());
      String columnName = HBaseUtils.getQualifierNameForColumn(table.getDiscriminatorColumn());
      Object discValue = new String(result.getValue(familyName.getBytes(), columnName.getBytes()));
      if (cmd.getDiscriminatorStrategy() == DiscriminatorStrategy.CLASS_NAME
          && !cmd.getFullClassName().equals(discValue)) {
        return null;
      } else if (cmd.getDiscriminatorStrategy() == DiscriminatorStrategy.VALUE_MAP
          && !cmd.getDiscriminatorValue().equals(discValue)) {
        return null;
      }
    }

    final FieldManager fm = new FetchFieldManager(ec, cmd, result, table);
    SCOID id = new SCOID(cmd.getFullClassName());
    Object pc =
        ec.findObject(
            id,
            new FieldValues() {
              // ObjectProvider calls the fetchFields method
              public void fetchFields(ObjectProvider op) {
                op.replaceFields(fpMembers, fm);
              }

              public void fetchNonLoadedFields(ObjectProvider op) {
                op.replaceNonLoadedFields(fpMembers, fm);
              }

              public FetchPlan getFetchPlanForLoading() {
                return null;
              }
            },
            null,
            ignoreCache,
            false);

    if (cmd.isVersioned()) {
      // Set the version on the object
      ObjectProvider op = ec.findObjectProvider(pc);
      Object version = null;
      VersionMetaData vermd = cmd.getVersionMetaDataForClass();
      if (vermd.getFieldName() != null) {
        // Set the version from the field value
        AbstractMemberMetaData verMmd = cmd.getMetaDataForMember(vermd.getFieldName());
        version = op.provideField(verMmd.getAbsoluteFieldNumber());
      } else {
        // Get the surrogate version from the datastore
        version = HBaseUtils.getSurrogateVersionForObject(cmd, result, tableName, storeMgr);
      }
      op.setVersion(version);
    }

    if (result.getRow() != null) {
      ObjectProvider sm = ec.findObjectProvider(pc);
      sm.setAssociatedValue("HBASE_ROW_KEY", result.getRow());
    }

    return pc;
  }
  protected static Object getObjectUsingDatastoreIdForResult(
      final Result result,
      final AbstractClassMetaData cmd,
      final ExecutionContext ec,
      boolean ignoreCache,
      final int[] fpMembers,
      String tableName,
      StoreManager storeMgr,
      Table table) {
    if (cmd.hasDiscriminatorStrategy()) {
      // Check the class for this discriminator value
      String familyName = HBaseUtils.getFamilyNameForColumn(table.getDiscriminatorColumn());
      String columnName = HBaseUtils.getQualifierNameForColumn(table.getDiscriminatorColumn());
      Object discValue = new String(result.getValue(familyName.getBytes(), columnName.getBytes()));
      if (cmd.getDiscriminatorStrategy() == DiscriminatorStrategy.CLASS_NAME
          && !cmd.getFullClassName().equals(discValue)) {
        return null;
      } else if (cmd.getDiscriminatorStrategy() == DiscriminatorStrategy.VALUE_MAP
          && !cmd.getDiscriminatorValue().equals(discValue)) {
        return null;
      }
    }

    String dsidFamilyName = HBaseUtils.getFamilyNameForColumn(table.getDatastoreIdColumn());
    String dsidColumnName = HBaseUtils.getQualifierNameForColumn(table.getDatastoreIdColumn());
    Object id = null;
    try {
      byte[] bytes = result.getValue(dsidFamilyName.getBytes(), dsidColumnName.getBytes());
      if (bytes != null) {
        ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
        ObjectInputStream ois = new ObjectInputStream(bis);
        Object key = ois.readObject();
        id =
            ec.getNucleusContext().getIdentityManager().getDatastoreId(cmd.getFullClassName(), key);
        ois.close();
        bis.close();
      } else {
        throw new NucleusException(
            "Retrieved identity for family="
                + dsidFamilyName
                + " column="
                + dsidColumnName
                + " IS NULL");
      }
    } catch (Exception e) {
      throw new NucleusException(e.getMessage(), e);
    }

    final FieldManager fm = new FetchFieldManager(ec, cmd, result, table);
    Object pc =
        ec.findObject(
            id,
            new FieldValues() {
              // ObjectProvider calls the fetchFields method
              public void fetchFields(ObjectProvider op) {
                op.replaceFields(fpMembers, fm);
              }

              public void fetchNonLoadedFields(ObjectProvider op) {
                op.replaceNonLoadedFields(fpMembers, fm);
              }

              public FetchPlan getFetchPlanForLoading() {
                return null;
              }
            },
            null,
            ignoreCache,
            false);

    if (cmd.isVersioned()) {
      // Set the version on the object
      ObjectProvider op = ec.findObjectProvider(pc);
      Object version = null;
      VersionMetaData vermd = cmd.getVersionMetaDataForClass();
      if (vermd.getFieldName() != null) {
        // Set the version from the field value
        AbstractMemberMetaData verMmd = cmd.getMetaDataForMember(vermd.getFieldName());
        version = op.provideField(verMmd.getAbsoluteFieldNumber());
      } else {
        // Get the surrogate version from the datastore
        version = HBaseUtils.getSurrogateVersionForObject(cmd, result, tableName, storeMgr);
      }
      op.setVersion(version);
    }

    if (result.getRow() != null) {
      ObjectProvider sm = ec.findObjectProvider(pc);
      sm.setAssociatedValue("HBASE_ROW_KEY", result.getRow());
    }

    return pc;
  }