[hibernate-dev] Question about Hibernate 4.0 Infinispan second level cache usage...
Sanne Grinovero
sanne at hibernate.org
Tue Aug 16 11:55:44 EDT 2011
2011/8/16 Scott Marlow <smarlow at redhat.com>:
> On 08/16/2011 11:08 AM, Sanne Grinovero wrote:
>>>
>>> I could try setting AvailableSettings.CACHE_REGION_PREFIX to the
>>> application
>>> scoped pu name. That seems to get added to the region name (region would
>>> then be: application name + PU jar name + PU name + entity class).
>>>
>>> Would that be likely to work?
>>
>> That sounds like a good plan
>
> Thanks for the help! :)
>
> Seems to work so far. I'm doing a little more testing...
>
> FYI, the following debug log output is from running my test case. This
> gives an idea of what the cache region names are for my three test PUs
> (mypc, SecondPU, ThirdPU):
>
> Building entity cache region
> [jpa_SecondLevelCacheTestCase.jar#mypc.org.jboss.as.testsuite.integration.jpa.hibernate.Employee]
>
> Building entity cache region
> [jpa_SecondLevelCacheTestCase.jar#SecondPU.org.jboss.as.testsuite.integration.jpa.hibernate.Employee]
>
> Building entity cache region
> [jpa_SecondLevelCacheTestCase.jar#ThirdPU.org.jboss.as.testsuite.integration.jpa.hibernate.Employee]
I'm thinking that you'll have to use a sound separator between the
strings you're concatenating, and escape it if it is used already.
Otherwise cleverly selected application names, PU names and jars might
lead to duplicate identifiers for different caches...
I know it's unlikely, but I guess it won't be straight forward to
change the cache naming pattern in future.
More information about the hibernate-dev
mailing list