You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2017/02/22 07:30:44 UTC

[jira] [Commented] (CAY-2243) ObjectContext.getGraphManager().unregisterObject() inconsistencies

    [ https://issues.apache.org/jira/browse/CAY-2243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15877659#comment-15877659 ] 

Andrus Adamchik commented on CAY-2243:
--------------------------------------

Here is a test showing the problem (and documenting the desired behavior) :  https://github.com/andrus/cayenne/commit/7d3ea21bcd5164b89d942562adadfe17e9d61786

> ObjectContext.getGraphManager().unregisterObject() inconsistencies
> ------------------------------------------------------------------
>
>                 Key: CAY-2243
>                 URL: https://issues.apache.org/jira/browse/CAY-2243
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 3.1.1, 4.0.M4
>            Reporter: Andrus Adamchik
>            Priority: Minor
>
> 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:
>         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);



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)