Esempio n. 1
0
  public Object extractPrimaryKeyFromInstance(CmpEntityBeanContext ctx) {
    try {
      Object pk = null;
      for (int i = 0; i < primaryKeyFields.length; ++i) {
        JDBCCMPFieldBridge pkField = primaryKeyFields[i];
        Object fieldValue = pkField.getInstanceValue(ctx);

        // updated pk object with return form set primary key value to
        // handle single valued non-composite pks and more complicated behivors.
        pk = pkField.setPrimaryKeyValue(pk, fieldValue);
      }
      return pk;
    } catch (EJBException e) {
      // to avoid double wrap of EJBExceptions
      throw e;
    } catch (Exception e) {
      // Non recoverable internal exception
      throw MESSAGES.errorExtractingPk(e);
    }
  }