Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
After digging some more, I think I know what is going on. It is more an result of your second example. object2 = // something that fetches object2 object1 = object2.getObject1(); // trips fault, fetches object1 object2 = // refetch object2 from cache object1 = object2.getObject1(); // trips

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
Thanks. That is pretty much our issue. If I do a prefetch however on object1 I everything works as expected. I'll have to dig deeper into our code to see what is going on. On Tue, May 17, 2016 at 2:48 PM, Michael Gentry wrote: > Hi Frank, > > There might still be something

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Michael Gentry
Hi Frank, There might still be something more going on here. When you initially fetch object2 for the first time, the relationship to object1 is a "fault" (assuming you don't prefetch). When you say object2.getObject1(), Cayenne will trigger the fault resulting in a SELECT statement sent to the

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
I believe your first example. Here is some clarification. object2 = // something that fetches object2 -- object2 is now in the object cache object1 = object2.getObject1(); // makes a call to the database and fetches object1 -- does not put object1 in the object cache object1 =

Re: Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Michael Gentry
Hi Frank, I'm a little confused by this part: "If we retrieve Object2 from the database, it is placed in the object cache. Afterwards, if we retrieve Object1 via the getter in Object2, Object1 is not cached. So, every time we make the request for Object1 via the getter, another call is made to

Caching Relationship Objects/Queries - Cayenne 3.1

2016-05-17 Thread Frank Herrmann
Hello all, I have a question regarding how Cayenne does caching. Right now, if we retrieve an object from the database via Cayenne, it is placed in the object cache. However, in our experience, if we then retrieve another object via the relationship on the first object, it is not cached. A rough