cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Herrmann <>
Subject Caching Relationship Objects/Queries - Cayenne 3.1
Date Tue, 17 May 2016 13:32:45 GMT
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 example:

public class Object1 {
    ... misc attributes ...

public class Object2 {
    ... misc attributes...
    private Object1 object1;

    public Object1 getObject1() {
        return object1;

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 the database. I have fixed this for individual
instances by using prefetches. However, our application is quite large, and
I don't like the idea of tracking down case.

Is there some way for Cayenne to place the relationship objects into the
object cache the first time they are retrieved? We are using EhCache for
our query caching, so if the object cache is not an options, is there a way
to store these relationships in a short lived query cache?

Thanks for the help.



T: 561-880-2998 x1563


[image: [ Modernizing Medicine ]] <>
[image: [ Facebook ]] <> [image:
[ LinkedIn ]] <> [image:
[ YouTube ]] <> [image: [
Twitter ]] <> [image: [ Blog ]]
<> [image: [ Instagram ]]

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message