Hello, I am trying to get the second-level cache to work. I log the summary of stats and I noticed that I always get ZERO second-level cache puts and hits whereas the query-cache gets puts and hits. Is that normal. Can anyone help me understand what's going on?? Thanks in advance, Julien Martin.
Here is the relevant snippet from my persitence.xml:
I havent used JPA extensively. So i wont be able to help you much. I would believe there would be some class level annotation which will allow you to enable caching the entity - Just a guess.
Julien Martin
Ranch Hand
Joined: Apr 24, 2004
Posts: 384
posted
0
Thanks anyhow for taking the time to reply!! I'll have a look at the jpa annotations. Best regards, Julien.
It looks to me like some values were being loaded into the second level cache. Why would you need to change your persistence.xml. The second level cache is not part of the JPA spec, so nothing would be defined in the spec defined persistence.xml.
Second Level caching here is a Hibernate specific thing, hence the Hibernate annotation instead.
It looks to me like some values were being loaded into the second level cache.
Please tell me what makes you say that?
Why would you need to change your persistence.xml. The second level cache is not part of the JPA spec, so nothing would be defined in the spec defined persistence.xml.
I make good note of this. I thought the property would just be ignored if the persistence provider was changed.
So, which cache provider are you using and did you define your cache region in that providers configuration file?
Not only do you put a cache usage in the mapping, but you also have to tell the provider what cache region to create
Ah, you use OSCacheProvider, not sure their configuration file name, but like for ehcache it is ehcache.xml.
I will also ask why you are using the query-cache. It is useful for data that never changes, because if the results change often, what you will have in the query-cache will be stale pretty quickly.