Example #1
0
 /**
  * OBSOLETE: Set the name of the field holding the sequence name.
  *
  * @deprecated use ((SDKSequence)getDefaultSequence()).setNameFieldName() instead
  */
 public void setSequenceNameFieldName(String sequenceNameFieldName) {
   if (getDefaultSequence() instanceof SDKSequence) {
     ((SDKSequence) getDefaultSequence()).setNameFieldName(sequenceNameFieldName);
   } else if (!sequenceNameFieldName.equals((new SDKSequence()).getNameFieldName())) {
     throw ValidationException.wrongSequenceType(
         Helper.getShortClassName(getDefaultSequence()), "setNameFieldName");
   }
 }
Example #2
0
 /**
  * OBSOLETE: Return the name of the field holding the sequence name.
  *
  * @deprecated use ((SDKSequence)getDefaultSequence()).getNameFieldName() instead
  */
 public String getSequenceNameFieldName() {
   if (getDefaultSequence() instanceof SDKSequence) {
     return ((SDKSequence) getDefaultSequence()).getNameFieldName();
   } else {
     throw ValidationException.wrongSequenceType(
         Helper.getShortClassName(getDefaultSequence()), "getNameFieldName");
   }
 }
  /**
   * INTERNAL: Override query execution where Session is a UnitOfWork.
   *
   * <p>If there are objects in the cache return the results of the cache lookup.
   *
   * @param unitOfWork - the session in which the receiver will be executed.
   * @param translationRow - the arguments
   * @exception DatabaseException - an error has occurred on the database.
   * @exception OptimisticLockException - an error has occurred using the optimistic lock feature.
   * @return An object, the result of executing the query.
   */
  public Object executeInUnitOfWork(UnitOfWorkImpl unitOfWork, AbstractRecord translationRow)
      throws DatabaseException, OptimisticLockException {
    if (unitOfWork.isNestedUnitOfWork()) {
      throw ValidationException.nestedUOWNotSupportedForModifyAllQuery();
    }

    // Bug4607551  For UpdateAllQuery, if deferred, add the original query with a translation row to
    // the deferredUpdateAllQueries for execution.
    // No action for non-deferred.  Later on the clones of all the UpdateAllQuery's will be added to
    // modifyAllQueries for validation.
    if (shouldDeferExecutionInUOW()) {
      unitOfWork.storeDeferredModifyAllQuery(this, translationRow);
      result = null;
    } else {
      if (!unitOfWork.isInTransaction()) {
        unitOfWork.beginEarlyTransaction();
      }
      unitOfWork.setWasNonObjectLevelModifyQueryExecuted(true);
      result = (Integer) super.executeInUnitOfWork(unitOfWork, translationRow);
    }
    return result;
  }