code: private void prepareInitialState(boolean isNewObject)
      {
          // determine appropriate modification state
          ModificationState initialState;
          if(isNewObject)
          {
              // if object is not already persistent it must be marked as new
              // it must be marked as dirty because it must be stored even if it will not modified during tx
              initialState = StateNewDirty.getInstance();
          }
          else if(isDeleted(oid))
          {
              // if object is already persistent it will be marked as old.
              // it is marked as dirty as it has been deleted during tx and now it is inserted again,
              // possibly with new field values.
              initialState = StateOldDirty.getInstance();
          }
          else
          {
              // if object is already persistent it will be marked as old.
              // it is marked as clean as it has not been modified during tx already
              initialState = StateOldClean.getInstance();
          }
          // remember it:
          modificationState = initialState;
      }
docs: Sets the initial MoificationState of the wrapped object myObj. The initial state will be StateNewDirty if myObj
  is not persisten already. The state will be set to StateOldClean if the object is already persistent.