Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2243

ObjectContext.getGraphManager().unregisterObject() inconsistencies

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0.M4, 3.1.1
    • 4.0.B1
    • None
    • None

    Description

      ObjectContext.getGraphManager().unregisterObject() behaves inconsistently between ROP and regular Cayenne in regards to the object state after unregistering, and I don't think either one of the two is fully correct.

      1. Here is the desired behavior, which seems like the most reasonable outcome - ObjectContext is set to null, persistent state - to TRANSIENT, ObjectId is preserved. I.e. object is kicked out of the context, but does not lose its identity:

      graphManager.unregisterNode(object.getObjectId());

      verify(object, times(0)).setObjectId(null);
      verify(object).setObjectContext(null);
      verify(object).setPersistenceState(PersistenceState.TRANSIENT);

      2. ROP Behavior:

      // succeeds
      verify(object, times(0)).setObjectId(null);
      // fails
      verify(object).setObjectContext(null);
      // fails
      verify(object).setPersistenceState(PersistenceState.TRANSIENT);

      3. Server Behavior:

      // fails
      verify(object, times(0)).setObjectId(null);
      // succeeds
      verify(object).setObjectContext(null);
      // succeeds
      verify(object).setPersistenceState(PersistenceState.TRANSIENT);

      Attachments

        Activity

          People

            ntimofeev Nikita Timofeev
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: