コード例 #1
0
  /** INTERNAL: Prepare the receiver for execution in a session. */
  public void prepareForExecution() throws QueryException {
    super.prepareForExecution();

    if (getObject() == null) {
      throw QueryException.objectToModifyNotSpecified(this);
    }
    setObject(this.descriptor.getObjectBuilder().unwrapObject(getObject(), getSession()));

    if (this.descriptor == null) {
      setDescriptor(getSession().getDescriptor(getObject().getClass()));
    }

    if (getPrimaryKey() == null) {
      setPrimaryKey(
          this.descriptor
              .getObjectBuilder()
              .extractPrimaryKeyFromObject(getObject(), getSession()));
    }

    if ((getTranslationRow() == null) || (getTranslationRow().isEmpty())) {
      setTranslationRow(
          this.descriptor.getObjectBuilder().buildRowForTranslation(getObject(), getSession()));
    }
  }