cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <>
Subject [jira] [Closed] (CAY-1777) Object context's localobject method, unexpected results on new object
Date Thu, 06 Dec 2012 18:25:16 GMT


Andrus Adamchik closed CAY-1777.

    Resolution: Implemented

Hi Manuel,

In 3.0.x 'localObject' was used internally by Cayenne to pass objects between parent and child
contexts in a nesting hierarchy, as well as exposed as a public API. So the behavior was somewhat
convoluted as it tried to address a set of contradictory expectations.

Since 3.1 'localObject' is intended for end users only (internal algorithms were redone differently)
and it features a much easier to understand behavior - it tries to locate a local object by
ObjectId (regardless of the original object state), if it is not there - creates a HOLLOW
object. If a user tries to further access the HOLLOW object, it is either resolved from DB
or parent context, or an exception is thrown.

Hopefully that makes it much more consistent.
> Object context's localobject method, unexpected results on new object
> ---------------------------------------------------------------------
>                 Key: CAY-1777
>                 URL:
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0.1
>         Environment: Ubuntu 12.04
>            Reporter: Manuel Sánchez
>            Priority: Minor
> A just new persistent object, persitence status = NEW, gets COMMITTED if you change it
from object context.
> MyClass o= objectContext.newObject( MyClass.class)
> -> o persistence status= NEW
> o2= objectContext2.localObject( o.getObjectId(), o)
> -> o2 persistence status= COMMITTED 
> It seems more suitable to return o2 in NEW persistence status.
> I know this is a consequence of some bad design, i changed it. Just trying to help the
framework gives the expected results.
> Thanks for you great work, i enjoy using CAY!

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message