Marcin,
This is indeed an omission in the new API - good catch. I'll add it
in a few days and post a note here when it becomes available in the
nightly build.
Note that your method will not work as it disregards the objects that
got in the context via a query. Instead once I add this
functionality, you will be able to do something like this:
objectContext.getGraphManager().getNodes();
Stay tuned.
Andrus
On Dec 7, 2005, at 4:11 AM, Marcin Skladaniec wrote:
> Hi All
> How can I access all objects registered with context ?
> With DataContext it can be done like this:
>
> java.util.Iterator iterator = ((ObjectStore)
> dataContext.getObjectStore()).getObjectIterator();
>
> I was looking for the way to do the same with ObjectContext. Do I
> have to subclass CayenneContext to get that feature ?
>
>
> If I'm going to subclass CayenneContext, I see it this way :
>
> public class ClientDataContext extends CayenneContext {
> Vector ObjectsRegisteredWithThisContext = new Vector();
>
> public List getRegisteredObjects() {
> return ObjectsRegisteredWithThisContext;
> }
>
> public Persistent newObject(Class persistentClass) {
> Persistent result = super.newObject(persistentClass);
> ObjectsRegisteredWithThisContext.add(result);
> return result;
> }
> .
> .
> .
> }
>
>
> Marcin Skladaniec
This archive was generated by hypermail 2.0.0 : Wed Dec 07 2005 - 02:54:37 EST