Andrus Adamchik <andru..bjectstyle.org> wrote:
> 1. Use Cayenne built-in remote notifications.
> Good thing about snapshot  
> events is that you can tell the listener exactly which objects were  
> modified.
Thanks.  The batch job updates hundreds of thousands of account objects, 
most of which aren't used by my web application, so providing a list of 
which objects were modified is probably not a good strategy in this case.
> 2. Continue using LAST_EXTERNAL_UPDATE and manually invalidate cache.
> 
> Here is one (but not the only) way to do that for just the shared  
> entities. For each "shared" entity create a named query in the Modeler  
> with Result Caching policy of "Shared Cache". Whenever you detect from  
> LAST_EXTERNAL_UPDATE that refresh is needed, you can do a refresh like  
> that:
> 
> 2a. Call "DateRowStore.cacheSnapshots("query_name", null) for each  
> "shared" query. This assumes that all your DataContexts access shared  
> object via such queries, and in no other way, and also that you don't  
> mind stale data in existing DataContexts.
> 
> or
> 
> 2b. Call DataContext.performQuery("query_name", true) for each shared  
> query. This will give you fresh objects immediately and as a side  
> effect refresh shared cache.
The problem is that my account objects are loaded indirectly.   I don't pull 
them in as a result of an explicit query, but only as the result of 
referencing a relationship getter method on other objects.
Is there a way to handle this without using a shared cache?
What about using
        getDataContext().getObjectStore().getObjects()
to iterate through all objects (does the above get all objects or only 
objects registered to a particular DataContext?), and then invalidating all 
objects of a specific (in this case "account") class?
I don't mind having stale data in existing datacontexts, so long as when new 
contexts are created via BasicServletConfiguration.getDefaultContext(), they 
have current data.
-Mike
This archive was generated by hypermail 2.0.0 : Mon Nov 22 2004 - 11:28:18 EST