« Return to Thread: Eclipselink caching behaviour

Re: Eclipselink caching behaviour

by James Sutherland :: Rate this Message:

Reply to Author | View in Thread

By default only the find() operation will get a cache hit, queries will always go to the database.

You can allow a query to get a cache hit using the "eclipselink.query-type"="ReadObject" query hint.


elygre wrote:
I'm working on understanding the eclipselink cache, and I still have quite a
way to go J

 

I have an entity with a single column primary key (String). If i use
"em.find(key)", this is cached, so that repeated lookups don't go to the
database. If i create a Query referring the  key ("select o from IkbPage o
where key = ?1"), and then use query.getSingleResult(), it is not cached,
and I see multiple identical queries.

 

Is there a configuration option I need to switch on?

Or is this just not possible?

 

Eirik

 « Return to Thread: Eclipselink caching behaviour