cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <>
Subject [jira] [Created] (CAY-1611) ObjectContext API improvement - better 'localObect' method
Date Sat, 03 Sep 2011 21:15:10 GMT
ObjectContext API improvement - better 'localObect' method

                 Key: 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'

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


View raw message