Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] how to set <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> dynamically

Hi Tom,

I'd like to stick as close to JPA as possible and use the @Cacheable to selectively enable caching for entities. However, I'd like to default cacheability to false. I understand that I can configure the individual cache settings per entity class using a ClassDescriptor. But I am fine with @Cacheable. My only issue is that I can't use the <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> switch in NetWeaver AS Java as the JPA container will reject the <shared-cache-mode> tag. 

Can I achieve the effect of <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> through a SessionCustomizer?

Thanks,

Adrian

Adrian Görler
SAP AG

Pflichtangaben/Mandatory Disclosure Statements:
http://www.sap.com/company/legal/impressum.epx 

-----Original Message-----
From: eclipselink-dev-bounces@xxxxxxxxxxx [mailto:eclipselink-dev-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
Sent: Dienstag, 8. Februar 2011 15:02
To: Dev mailing list for Eclipse Persistence Services
Subject: Re: [eclipselink-dev] how to set <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> dynamically

Hi Adrian,

   This setting allows individual Entities to have their own cache settings. 
The way to get at the cache settings is to get the ClassDescriptors from the 
Project.  The project is stored in the Session held by the EntityManagerFactory.

ClassDescriptor has methods like setIdentityMapClass, setIdentityMapSize that 
control the cache

The best way to access these things at runtime is through a SessionCustomizer.

If you need to make changes later than the SessionCustomizer runs, 
org.eclipse.persistence.jpa.JpaHelper has methods that allow you to unwrap the 
various internal components, but you'll have to be careful after you have 
started to do things that put elements in the cache and may have to do some 
additional work to get things working because the initialization of the 
descriptors handles some of configuration.

-Tom

Goerler, Adrian wrote:
> Hi,
> 
>  
> 
> yes, I can confirm this.
> 
>  
> 
> I just don't know how to achieve the effect of 
> <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> dynamically.
> 
>  
> 
> Best regards,
> 
>  
> 
> Adrian
> 
>  
> 
>  
> 
> *Adrian Görler
> **SAP AG
> 
> *Pflichtangaben/Mandatory Disclosure Statements:
> http://www.sap.com/company/legal/impressum.epx
> 
>  
> 
> *From:* Rohit Banga [mailto:rohit.banga@xxxxxxxxxx]
> *Sent:* Dienstag, 8. Februar 2011 08:55
> *To:* Dev mailing list for Eclipse Persistence Services
> *Cc:* Goerler, Adrian
> *Subject:* Re: [eclipselink-dev] how to set 
> <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> dynamically
> 
>  
> 
> Hi Adrian
> 
> It seems to me that this feature was added as part of JPA 2.0.
> http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/cache_usaged#Section_3.7.1_-_The_shared-cache-mode_element
> Can someone please confirm this?
> 
> On 2/8/2011 1:14 PM, Goerler, Adrian wrote:
> 
> Hi,
> 
>  
> 
> is there a way to specify 
> <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> dynamically? In 
> my server, I can't specify this element statically, as it is rejected by 
> my servers JPA (1.0) container.
> 
>  
> 
> There is the property <property name="eclipselink.cache.shared.default" 
> value="false"/>, but it is not equivalent as it cannot be overridden 
> with @Cacheable.
> 
>  
> 
> Best regards,
> 
>  
> 
> Adrian
> 
>  
> 
> *Adrian Görler
> **SAP AG
> 
> *Pflichtangaben/Mandatory Disclosure Statements:
> http://www.sap.com/company/legal/impressum.epx
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> _______________________________________________
> 
> eclipselink-dev mailing list
> 
> eclipselink-dev@xxxxxxxxxxx <mailto:eclipselink-dev@xxxxxxxxxxx>
> 
> https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
> 
>  
> 
> -- 
> Thanks and Regards
> Rohit Banga
> Member Technical Staff
> Oracle Server Technologies
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> eclipselink-dev mailing list
> eclipselink-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev


Back to the top