-
1. Re: JPA 2nd level cache question
sannegrinovero Oct 25, 2010 5:58 AM (in response to sandstorm)Hi,
yes it's expected to do that, but seems more a Hibernate (general) related question, this is not something specific to Infinispan 2nd level cache but of any 2nd level cache.
Make sure you enable the query cache (globally) and enable caching on the query instance.
Also keep in mind that this cache is going to be invalidated each time a A is inserted/removed.
-
2. Re: JPA 2nd level cache question
sandstorm Oct 27, 2010 6:30 PM (in response to sannegrinovero)Well I am not that into the Hibernate internals. I am using the JPA technology. Hibernate should be left out as an implementation detail here.
If the query cache is enabled globally, must I enable query cache for each query ?
And do you mean this cache entry (the count) is going to be invalidated, or do you mean if an A is added then the entire cluster wide cache with all entries of all classes ever created in the life of the entire cluster are invalidated ?
Thanks
-
3. Re: JPA 2nd level cache question
sannegrinovero Oct 27, 2010 6:38 PM (in response to sandstorm)Well I am not that into the Hibernate internals. I am using the JPA technology. Hibernate should be left out as an implementation detail here
sure, but you still might want to read the manual relating to Hibernate specific features, such as caching.
If the query cache is enabled globally, must I enable query cache for each query ?
yes; I'd suggest to enable SQL statements logging, so that you can verify what and when is cached with trivial testing
And do you mean this cache entry (the count) is going to be invalidated, or do you mean if an A is added then the entire cluster wide cache with all entries of all classes ever created in the life of the entire cluster are invalidated ?
only the query count or other queries related to A(s) are invalidated, specific cache entries related to other instances of A (as per a different primary key) or any other type are unaffected.
-
4. Re: JPA 2nd level cache question
henk53 Oct 29, 2010 6:56 AM (in response to sannegrinovero)Sanne Grinovero wrote:
Well I am not that into the Hibernate internals. I am using the JPA technology. Hibernate should be left out as an implementation detail here
sure, but you still might want to read the manual relating to Hibernate specific features, such as caching.
Of course caching itself (including 2nd level cache and query caching) is part of the core JPA specification, but configuring a caching provider for a specific JPA provider is still proprietary I think.