Пример #1
0
  public void setValueInternal(CmpEntityBeanContext ctx, Object value, boolean makeDirty) {
    PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();

    // todo this is weird
    if (cmpFieldIAmMappedTo != null && cmpFieldIAmMappedTo.isPrimaryKeyMember) {
      Object curValue = pctx.getFieldValue(rowIndex);
      if (value != null && !value.equals(curValue)) {
        throw CmpMessages.MESSAGES.attemptToModifyPkThroughFk(
            entity.getEntityName(),
            cmpFieldIAmMappedTo.getFieldName(),
            entity.getQualifiedTableName(),
            cmpFieldIAmMappedTo.getColumnName(),
            curValue,
            value);
      }

      makeDirty = false;
    } else {
      pctx.setFieldValue(rowIndex, value);
    }

    if (makeDirty) {
      pctx.setDirty();
    }
  }
Пример #2
0
 public Object getValue(CmpEntityBeanContext ctx) {
   PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();
   return pctx.getFieldValue(rowIndex);
 }