Re: DataObjectUtils.objectForPK, ObjectStore and DataRowStore

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Sep 23 2004 - 09:23:43 EDT

  • Next message: Stefaan Huysentruyt: "Extensive DEBUG Logging when using a WebApplicationListener"

    Hi Tore,

    Your observation is right - "objectForPk" doesn't look beyond
    ObjectStore. Hmm... let me think about it some more, I may actually add
    a shared cache lookup, this is trivial. The only reservation I have now
    is that we need a better underlying cache map implementation - the one
    that timestamps snapshots to avoid having very old data. Still, I think
    we should do a shared cache lookup in this case..

    Andrus

    On Sep 23, 2004, at 2:39 AM, Tore Halset wrote:
    > Hello.
    >
    > I am using DataObjectUtils.objectForPK(...) in a newly created
    > DataContext to fetch objects. The objects haa already been fetched in
    > another DataContext. I hoped that this would not result in a fetch
    > from the database, but a fetch from the cache. I have checked the "Use
    > Shared Cache" checkbox in the modeler.
    >
    > The following code results in two queries. The cell with id "XX222222"
    > are found in the first query as well. If I do not create the second
    > DataContext the code only executes a single query.
    >
    > DataContext ctxt = DataContext.createDataContext();
    >
    > // query for all cells
    > SelectQuery query = new SelectQuery(Cell.class);
    > ctxt.performQuery(query);
    >
    > // create a new context
    > ctxt = DataContext.createDataContext();
    >
    > // find a single cell
    > Cell c = (Cell)DataObjectUtils.objectForPK(ctxt, Cell.class,
    > "XX222222");
    > log("found cell " + c.getCellId());
    >
    > Am I missing something? Are objectForPK only looking in the
    > ObjectStore for cached objects? Or are my cell not in the
    > DataRowStore?
    >
    > All of this is with 1.1B2 and 1.1B3.
    >
    > Regards,
    > - Tore.



    This archive was generated by hypermail 2.0.0 : Thu Sep 23 2004 - 09:23:50 EDT