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 2011/09/03 23:15:10 UTC
[jira] [Created] (CAY-1611) ObjectContext API improvement - better
'localObect' method
ObjectContext API improvement - better 'localObect' method
----------------------------------------------------------
Key: CAY-1611
URL: https://issues.apache.org/jira/browse/CAY-1611
Project: Cayenne
Issue Type: Improvement
Components: Core Library
Affects Versions: 3.1M2
Reporter: Andrus Adamchik
Assignee: Andrus Adamchik
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' internally.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (CAY-1611) ObjectContext API improvement - better
'localObect' method
Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CAY-1611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
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: https://issues.apache.org/jira/browse/CAY-1611
> 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' internally.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira