Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] javax.persistence.sharedCache.mode=ENABLE_SELECTIVE seems to have no effect

What behavior are you seeing that indicates the shared cache is being used?

On 15/09/2013 1:28 PM, Andreas Joseph Krogh wrote:
På søndag 15. september 2013 kl. 19:12:12, skrev Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>:
Hi.
 
I'm wiring my JPA PU using Spring only (no persistence.xml) as I have a PU spread over different modules, in a JSE-environment. I use Spring's LocalContainerEntityManagerFactoryBean with packagesToScan property to scan the classpath for my annotated classes.
 
I'm then trying to cache some entities using javax.persistence.sharedCache.mode=ENABLE_SELECTIVE semantics, that is; I don't want caching on anything that doesn't have the JPA-2.0's @Cacheable(enabled = true) annotation. I'm unable to achieve this however. EL seems to enable caching for everything as default so I'm using this property to disable it:
 
(JPA-properties set by Spring):
 
                <prop key="eclipselink.cache.shared.default">false</prop>
                <prop key="javax.persistence.sharedCache.mode">ENABLE_SELECTIVE</prop>
 
Disabling the cache seems to work but enableing the ENABLE_SELECTIVE-semantics setting the javax.persistence.sharedCache.mode property seems to have no effect.
 
The docs I can find and Google all suggest setting the persistence.xml property <shared-cache-mode>NONE</shared-cache-mode>. This should have the same effect as setting the JPA-property javax.persistence.sharedCache.mode=ENABLE_SELECTIVE as far as I can tell.
 
Can anyone shed some light on what I'm doing wrong and if my setup is supposed to work?
 
Not specifying the eclipselink.cache.shared.default property at all and just having javax.persistence.sharedCache.mode=ENABLE_SELECTIVE results in everything being cached, also entities not annotated with @Cacheable.
 
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
 


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top