persistence@glassfish.java.net

Re: Clear All

From: Adam Bien <abien_at_adam-bien.com>
Date: Fri, 01 Feb 2008 08:59:45 +0100

Hi Markus,

I can clear the L1 cache with clear(). But I would like to clear the L2
caches as well. This is not a a part of the JPA spec...

The Use Case: your customer would like to reload all object from the
database and you have so to invalidate / reload all objects.

Refresh(enttiy) would do the work however there is no refreshAll...
Clear() seems to clear only to L1 cache...

In my previous email I just complained about clear(), but actually ment
refresh(). However the effect is the same :).

I try to introduce refreshAll to JPA 2.0 - however it's not that easy :-),

regards,

adam

Markus KARG schrieb:
> Adam,
>
> I cannot deliver a solution but I am curious why one wants to clear
> the cache? Or do you mean invalidating it (i. e. force a complete
> reload)?
>
> Thanks
> Markus
>
> Adam Bien schrieb:
>> Hello,
>>
>> is it possible to clear all entities in the TopLink Caches? The
>> method EntityManager::clear() expects an Entity as an argument - so
>> you have to hold all attached entities which have to have cleared
>> (which is hard in the practice).
>>
>> I know this functionality is proprieatary and not a part of the JPA
>> standard. Is there a way in TopLink Essentials to clear all entities
>> in the second level cache?
>>
>> thank you in advance,
>>
>> regards,
>>
>> adam
>>
>>
>
>


-- 
Consultant, Author, Java Champion
Homepage: www.adam-bien.com
Weblog: blog.adam-bien.com
eMail:  abien_at_adam-bien.com
Mobile: 0049(0)170 280 3144
Books: Enterprise Architekturen (ISBN: 393504299X),
        Java EE 5 Architekturen  (ISBN: 3939084247),
        J2EE Patterns, J2EE Hotspots, Enterprise Frameworks and Struts