Moving 3 tier (ObjectContext problem)

From: Marcin Skladaniec (marci..sh.com.au)
Date: Tue Dec 06 2005 - 20:11:12 EST

  • Next message: Jürgen Saar: "Re: DataObjectUtils.objectForPK() caches- is there a way to not use the cache on this one?"

    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 : Tue Dec 06 2005 - 20:11:15 EST