I haven't found any specific documentation that details this, just pieces that allude to it.
Say I have a report object that is mapped in Hibernate with a composite primary key. The key is report number and a report version. If I have the second level cache enabled, the report object will be cached in a disassembled state with the composite key as the cache key.
If I wanted to query for the report object by name using Query.list(). It will not retrieve the report from cache since I am not querying by primary key. If I make the query cacheable, Query.setCacheable(true), list() will retrieve and cache the reports' primary keys. The next time I query by report name, the report primary key will be retrieved from the query cache. The primary key will then be used to retrieve the report from the second level cache.
Is this correct?
If there are multiple nodes in a cluster using jBoss replicated cache, if one node creates a new object, in order for the other nodes to be able to retrieve the objects from cache, query cache needs to be enabled.
|