/** Method to delete the object from the datastore. */
  protected void internalDeletePersistent() {
    if (isDeleting()) {
      throw new NucleusUserException(Localiser.msg("026008"));
    }

    activity = ActivityState.DELETING;
    try {
      if (dirty) {
        clearDirtyFlags();

        // Clear the PM's knowledge of our being dirty. This calls flush() which does nothing
        myEC.flushInternal(false);
      }

      myEC.getNucleusContext();
      if (!isEmbedded()) {
        // Nothing to delete if embedded
        getStoreManager().getPersistenceHandler().deleteObject(this);
      }

      preDeleteLoadedFields = null;
    } finally {
      activity = ActivityState.NONE;
    }
  }