db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@SUN.com>
Subject Re: refresh()
Date Tue, 01 May 2007 16:17:26 GMT
Hi Christiaan,

On May 1, 2007, at 9:06 AM, Christiaan des Bouvrie wrote:

> Hello  Craig,
>
> Thanks for the reply. We do not actually always refresh because of the
> OptimisticVerificationException, but sometimes we want to make sure  
> the
> user is seeing the latest data.
>
> Also, the datastore cache is not shared between clients, since we  
> have a
> rich-client application. So imagine the following scenario (not  
> sure if
> we have the same scenario in mind, since I cant really explain the  
> need
> for flush()):
>
> -          Client A views an object, and loads it in his datastore
> cache;
>
> -          Client B views and modifies the same object. His datastore
> cache gets updated and also the datastore.
>
> -          Client A now wants to see the latest version, but the stale
> version is still in his datastore cache since it is not shared with
> client B. How to get the latest version from the datastore?

Two things come to mind. First, perhaps there is a vendor-specific  
policy that you can use to specify that refresh should evict the  
instances from the datastore cache.

Second, you might use the standard DataStoreCache interface:

// get fresh instances from the datastore
pm.getDataStoreCache().evictAll(collection);
pm.refresh(collection);

Craig
>
>
>
> Kind regard,
>
> Christiaan
>
>
>
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message