db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leschke Scott-QA2775" <Scott.Lesc...@motorola.com>
Subject RE: refresh()
Date Tue, 01 May 2007 18:21:03 GMT

What's the state of 2.1?  Might a pm.refresh(Object, boolean) method be
appropriate where  a true value would equate to the following as you
suggested. Just a thought.
 
pm.getDataStoreCache().evictAll(collection);
pm.refresh(collection);

-----Original Message-----
From: Craig L Russell [mailto:Craig.Russell@SUN.com] 
Sent: Tuesday, May 01, 2007 11:17 AM
To: jdo-user@db.apache.org
Cc: JDO Expert Group; Apache JDO project
Subject: Re: refresh()

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