Re: Newbie, retrieving list from specific class DataObjects

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Feb 06 2004 - 16:02:34 EST

  • Next message: Steve Steinitz: "Solved: problem with flattened relationship"

    What Tore's suggestion implies is that Cayenne ObjectStore doesn't
    internally organize objects by class. So you may need to implement your
    own caching strategy (i.e. a simple HashMap) on top of that, storing
    query results for each entity.

    We are planning to add such shared cache approach eventually (maybe in
    1.1), but it shouldn't be too hard to do it manually.

    Andrus

    On Feb 6, 2004, at 9:05 AM, Tore Halset wrote:
    > On Feb 6, 2004, at 13:49, Nenko Ivanov wrote:
    >
    >> Hi all. I am newbie in Cayenne.
    >> My application need is all the data from the database to be loaded
    >> into memory at application start.
    >> So I have one static DataContex and load it using 
    >>  
    >> SelectQuery query = new SelectQuery(SomeClass.class);
    >> dataContext.performQuery(query);
    >> ............. // some similar queries
    >>  
    >> The loaded data is relational and everything works file for me.
    >> But it looks logic for me to have method that retrieves all the
    >> DataObjects from DataContex that
    >> are instances of some specific DataObject subclass.
    >
    > Are you able to keep one List for every DataObject subclass?
    >
    > SelectQuery query = new SelectQuery(Apple.class);
    > List apples = dataContext.performQuery(query);
    > .......... // some similar queries
    >
    > - Tore.



    This archive was generated by hypermail 2.0.0 : Fri Feb 06 2004 - 16:02:41 EST