コード例 #1
0
  /**
   * Method that will unload all fields that are not in the FetchPlan. This is typically for use
   * when the instance is being refreshed.
   */
  public void unloadNonFetchPlanFields() {
    int[] fpFieldNumbers = myFP.getMemberNumbers();
    int[] nonfpFieldNumbers = null;
    if (fpFieldNumbers == null || fpFieldNumbers.length == 0) {
      nonfpFieldNumbers = cmd.getAllMemberPositions();
    } else {
      int fieldCount = cmd.getMemberCount();
      if (fieldCount == fpFieldNumbers.length) {
        // No fields that arent in FetchPlan
        return;
      }

      nonfpFieldNumbers = new int[fieldCount - fpFieldNumbers.length];
      int currentFPFieldIndex = 0;
      int j = 0;
      for (int i = 0; i < fieldCount; i++) {
        if (currentFPFieldIndex >= fpFieldNumbers.length) {
          // Past end of FetchPlan fields
          nonfpFieldNumbers[j++] = i;
        } else {
          if (fpFieldNumbers[currentFPFieldIndex] == i) {
            // FetchPlan field so move to next
            currentFPFieldIndex++;
          } else {
            nonfpFieldNumbers[j++] = i;
          }
        }
      }
    }

    // Mark all non-FetchPlan fields as unloaded
    for (int i = 0; i < nonfpFieldNumbers.length; i++) {
      loadedFields[nonfpFieldNumbers[i]] = false;
    }
  }
コード例 #2
0
 /** Method to (re)connect the provider to the specified ExecutionContext and object type. */
 public void connect(ExecutionContext ec, AbstractClassMetaData cmd) {
   int fieldCount = cmd.getMemberCount();
   this.cmd = cmd;
   this.dirtyFields = new boolean[fieldCount];
   this.loadedFields = new boolean[fieldCount];
   this.dirty = false;
   this.myEC = ec;
   this.myFP = myEC.getFetchPlan().getFetchPlanForClass(cmd);
   this.lock = new ReentrantLock();
   this.lockMode = LockManager.LOCK_MODE_NONE;
   this.savedFlags = 0;
   this.savedLoadedFields = null;
   this.objectType = 0;
   this.activity = ActivityState.NONE;
   this.myVersion = null;
   this.transactionalVersion = null;
   this.persistenceFlags = 0;
 }