public CFGenKbISOCountryCurrencyBuff lockDerived(
     CFGenKbAuthorization Authorization, CFGenKbISOCountryCurrencyPKey PKey) {
   final String S_ProcName = "CFGenKbRamISOCountryCurrency.readDerived() ";
   CFGenKbISOCountryCurrencyPKey key = schema.getFactoryISOCountryCurrency().newPKey();
   key.setRequiredISOCountryId(PKey.getRequiredISOCountryId());
   key.setRequiredISOCurrencyId(PKey.getRequiredISOCurrencyId());
   CFGenKbISOCountryCurrencyBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public void createISOCountryCurrency(
      CFGenKbAuthorization Authorization, CFGenKbISOCountryCurrencyBuff Buff) {
    final String S_ProcName = "createISOCountryCurrency";
    CFGenKbISOCountryCurrencyPKey pkey = schema.getFactoryISOCountryCurrency().newPKey();
    pkey.setRequiredISOCountryId(Buff.getRequiredISOCountryId());
    pkey.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());
    Buff.setRequiredISOCountryId(pkey.getRequiredISOCountryId());
    Buff.setRequiredISOCurrencyId(pkey.getRequiredISOCurrencyId());
    CFGenKbISOCountryCurrencyByCountryIdxKey keyCountryIdx =
        schema.getFactoryISOCountryCurrency().newCountryIdxKey();
    keyCountryIdx.setRequiredISOCountryId(Buff.getRequiredISOCountryId());

    CFGenKbISOCountryCurrencyByCurrencyIdxKey keyCurrencyIdx =
        schema.getFactoryISOCountryCurrency().newCurrencyIdxKey();
    keyCurrencyIdx.setRequiredISOCurrencyId(Buff.getRequiredISOCurrencyId());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableISOCountry()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredISOCountryId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(),
                  S_ProcName,
                  "Container",
                  "ISOCountryCurrencyCountry",
                  "ISOCountry",
                  null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCountryIdx;
    if (dictByCountryIdx.containsKey(keyCountryIdx)) {
      subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx);
    } else {
      subdictCountryIdx =
          new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>();
      dictByCountryIdx.put(keyCountryIdx, subdictCountryIdx);
    }
    subdictCountryIdx.put(pkey, Buff);

    Map<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff> subdictCurrencyIdx;
    if (dictByCurrencyIdx.containsKey(keyCurrencyIdx)) {
      subdictCurrencyIdx = dictByCurrencyIdx.get(keyCurrencyIdx);
    } else {
      subdictCurrencyIdx =
          new HashMap<CFGenKbISOCountryCurrencyPKey, CFGenKbISOCountryCurrencyBuff>();
      dictByCurrencyIdx.put(keyCurrencyIdx, subdictCurrencyIdx);
    }
    subdictCurrencyIdx.put(pkey, Buff);
  }