cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <>
Subject [jira] [Closed] (CAY-1611) ObjectContext API improvement - better 'localObect' method
Date Mon, 12 Sep 2011 06:49:09 GMT


Andrus Adamchik closed CAY-1611.

       Resolution: Fixed
    Fix Version/s: 3.1M3

Closing in M3. The user facing part is finished. Will open a separate Jira to migrate the
internal callers of this method to something else.

> ObjectContext API improvement - better 'localObect' method
> ----------------------------------------------------------
>                 Key: CAY-1611
>                 URL:
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.1M2
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1M3
> One more eye sore in the ObjectContext API is localObject method. While it is an important
API for the Cayenne users to locate the copies of their objects between contexts, it is also
used by Cayenne internal code to find-or-create objects for ObjectId or to transfer objects
from parent to child contexts (either the same VM or via ROP). 
> The goal of this task is to separate the internal Cayenne concerns from the public API.
I contend that the only API that needs to be exposed publicly is something like this:
>   /**
>    * Provides a copy of 'objectFromAnotherContext' local to this context, creating and
registering a local hollow object if needed. 
>    * 'objectFromAnotherContext' parameter must not be NEW or TRANSIENT, i.e. it must
have a non-temporary ObjectId pointing 
>    * to a row in the DB. Otherwise an Exception is thrown.
>    */ 
>   T localObject(T objectFromAnotherContext)
> A usercase where a user has no object, but has an ObjectId can be handled via an ObjectIdQuery
or better - via Cayenne.objectForPK(ObjectContext, ObjectId). All other usecases are deemed
internal to Cayenne. So Cayenne core should be refactored to stop relying on 'localObject'

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message