You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Anthony Brew <an...@swrve.com> on 2011/09/01 19:15:07 UTC

External Database Modification

Hi,
    I have a two processes one which writes to a several database tables (a
ruby on rails application) and a java application that reads the state these
data base tables using Cayenne and writes to other tables.

When the ruby modifies the underlying data-base I am seeing that Cayenne is
not automatically picking up that the underlying data is now inconsistant
and not reloading. Is there some way I can config Cayenne to aggressive
check some tables for updates while ignoring others?

Thanks a Million
Anthony Brew

Re: External Database Modification

Posted by Andrus Adamchik <an...@objectstyle.org>.
There are a few ways of doing it. My favorite is to use SelectQuery's with caching enabled, and OSCache as a cache provider:

http://cayenne.apache.org/doc/query-result-caching.html

Then you assign each query a cache group String, and configure expiration policies for each cache group. Finally to refresh objects related to the query objects on cache expiration, set desired prefetches for each query.

From here - make sure you don't store query results in your code, and access them via a query instead. 

Andrus

On Sep 1, 2011, at 1:15 PM, Anthony Brew wrote:
> Hi,
>    I have a two processes one which writes to a several database tables (a
> ruby on rails application) and a java application that reads the state these
> data base tables using Cayenne and writes to other tables.
> 
> When the ruby modifies the underlying data-base I am seeing that Cayenne is
> not automatically picking up that the underlying data is now inconsistant
> and not reloading. Is there some way I can config Cayenne to aggressive
> check some tables for updates while ignoring others?
> 
> Thanks a Million
> Anthony Brew