Hi,
This is due to the 'eventual consistency' of queries on the HR datastore.
http://code.google.com/appengine/docs/java/datastore/hr/overview.html
http://code.google.com/appengine/docs/java/datastore/hr/
Instead of a query, you need to get the entity by key:
http://code.google.com/appengine/docs/java/datastore/entities.html#Saving_Getting_and_Deleting_Entities
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreService.html#get(com.google.appengine.api.datastore.Key)
Robert
On Sat, Aug 13, 2011 at 13:38, Gooly <[email protected]> wrote:
> Hi,
>
> I am using the development server on java with eclipse plugin.
> I use JDO to store to datastore.
>
> I am experiencing a delay in storing data to the datastore, which will
> effect the later get.
>
> When I store data to the datastore with code like the following,
>
> PersistenceManager pm = PMF.get().getPersistenceManager();
> try {
> if (pm.makePersistent(input) != null) {
> return true;
> }
> } finally {
> pm.close();
> }
> return false;
>
> and then I get with the following code:
>
> PersistenceManager pm = PMF.get().getPersistenceManager();
>
> String query = "select from " + UserData.class.getName() + " where
> key == '" + key +"'";
>
> List<UserData> udList = (List<UserData>)
> pm.newQuery(query).execute();
>
> It usually works, but when I have a store and an immediate get, I
> sometimes get the old data before the new store.
>
> I wonder is this an issue only on the development server, or would it
> be the same on the appengine?
>
> Thanks,
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.