Re: Data base externally modified

2011-09-03 Thread Anthony Brew
Hi Andrus, That has worked nicely, thanks a mill for all your help On Fri, Sep 2, 2011 at 7:02 PM, Andrus Adamchik wrote: > Another way to refresh an object, including the content of its > relationships (but not the contents of the related objects) is this: > > context.invalidate

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
Another way to refresh an object, including the content of its relationships (but not the contents of the related objects) is this: context.invalidateObjects(Collections.singleton(myObject)); This may be more in line of what you are trying to do. Andrus On Sep 2, 2011, at 1:59 PM, Andrus Adamc

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
In general a Cayenne user may be dealing with an object graph that can potentially start at 1 entity and then span the entire DB (prefetches can be multi-step). So Cayenne can't guess for you which relationships need to be refreshed, without potentially incurring a gigantic query. So it is sti

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi Andrus, Yeah thats the most viable solution I have found so far, but tbh but from a code point of view here I think its a risky option as it could introduce bugs, it not all changing properties are added to the prefetch. query.addPrefetch(Item.SUB_ITEMS_PROPERTY); Would be nice

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
To refresh a relationship, you may use a prefetch on the query: query.addPrefetch(Item.SUB_ITEMS_PROPERTY); Andrus On Sep 2, 2011, at 12:51 PM, Joseph Senecal wrote: > I think the generated code for the getter() should always return the existing > list because that is the whole point of an O

Re: Data base externally modified

2011-09-02 Thread Joseph Senecal
I think the generated code for the getter() should always return the existing list because that is the whole point of an ORM, to manage an object graph in memory. But it should be easy to override that getter() method in the generated subclass to always do an uncached query. Joe On Sep 2, 201

Re: Data base externally modified

2011-09-02 Thread Mike Kienenberger
There may be a better way, but one obvious way this could be done is to change the code generation so that the getter() executes a select query rather than returning an existing list. On Fri, Sep 2, 2011 at 11:28 AM, Anthony Brew wrote: > Hi, >Just an update, and I think I forgot to include s

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi, Just an update, and I think I forgot to include something important Its a one to many relationship that I am seeing cached, (ie I fetch "Item" and the many to one "Item.getSubItems()" are being fetched from the cache) My code now looks a bit like: Expression e1 = Expression.fromSt

Re: Data base externally modified

2011-09-02 Thread Mike Kienenberger
You may want to review these two threads from the end of July: OSCache is gone http://www.mail-archive.com/dev@cayenne.apache.org/msg06209.html EhCache integration preview http://www.mail-archive.com/user@cayenne.apache.org/msg06211.html On Fri, Sep 2, 2011 at 10:30 AM, Anthony Brew wrote: > H

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi Andrus, I was just about to get back to you on, I accidentally started two threads when I joined the mailing list. Essentially we have a ruby on rails project that creates config on the front end, this is the part that is changing externally. Then internally we read these config

Re: Data base externally modified

2011-09-02 Thread Andrus Adamchik
Could you please explain your data access patterns? E.g. if you fetch some objects and store them in an instance variable in your application, they are not going to get refreshed automatically. To refresh objects you need to either invalidate them explicitly via context.invalidateObjects() or r

Re: Data base externally modified

2011-09-02 Thread Anthony Brew
Hi Gary, Yeah thats what I am seeing in the code, but I cant for the life of me see how to turn off the caching completely in the modeller, I actually think it wont hit our performance very badly to have no caching. The cache setting I see are the in the DataDomain Configuration Which

Re: Data base externally modified

2011-09-01 Thread Gary Jarrel
I'd say that would be cache related, as Cayenne is caching the data from the database, switch the cache of in the Modeler perhaps and that should fix your problem. G On Fri, Sep 2, 2011 at 3:04 AM, Anthony Brew wrote: > Hi, >    I have a two processes one which writes to a several database table

Data base externally modified

2011-09-01 Thread Anthony Brew
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 au