I updated the docs last week -- if you still see any issues, let me know.
The revised tutorial works for me now.
Try calling pm.close directly after persisting the object. Then get a
PersistenceManager to execute your query, and see if that makes a
difference.

- Jason

On Mon, Aug 17, 2009 at 9:00 AM, objectuser <[email protected]> wrote:

>
> You followed all the steps in this thread?
>
>
> http://groups.google.com/group/google-appengine-java/browse_thread/thread/9a5ca03a216cd0a9
>
> There are a few.  The google docs are out of date and you need to use
> the code in the other link.
>
> Have you done all of that?
>
> On Aug 17, 9:16 am, - Ray <[email protected]> wrote:
> > Is there two Datastore instances in the test enviroment?
> >
> > i am using GWT 1.7, Google Plugin 1.2.2 und Eclipse Galileo. the same
> Issue
> > exists in GWT 1.6, Google Plugin 1.2.1 und Eclipse 3.4.
> >
> > recently i have got a problem like below:
> >
> > My example is simple:
> > 1.  Create an object and save it,  then use Service to update its value.
> > 2. load it using pm with id direct from Datastore. the Changes doesn't
> take
> > effect.
> > 3.  but when i load it using service to retrieve it from datastore, the
> > Changes take effect.
> >
> > WorkitemService uses JDO to save the Object of Workitem and update the
> > Object of Workitem.
> > Workitem is a class simply saves data.
> >
> > source code below demonstrate the Problem i got:
> >
> > private WorkitemServiceImpl wsi = new WorkitemServiceImpl();
> > PersistenceManager pm = PMF.get().getPersistenceManager();
> >
> > public void testUpdate() {
> >
> > try {
> >
> > Date date = new Date();
> >                 Date date1 = new Date();
> >                 Long user_id = 1L;
> >      Workitem wi1 = new Workitem("test", 1, "tag", date, user_id);
> >      pm.makePersistent(wi1);
> >      Workitem wi2 = pm.detachCopy(wi1);
> > wi2.setDescription("test1");
> >  wi2.setTagString("tag1 tag2");
> > wi2.setDuration(2);
> > wi2.setDate(date1);
> >  wsi.update(wi2);
> > ArrayList<Workitem> workitems = wsi.loadWorkitems(user_id);
> >  Workitem wi3 = workitems.get(0);
> >  assertEquals(wi2.getId(), wi3.getId());
> > assertEquals("test1", wi3.getDescription());
> >  assertEquals(2, wi3.getDuration());
> > assertEquals("tag1 tag2", wi3.getTagString());
> >  assertEquals(date1, wi3.getDate());
> >     } catch (Exception e) {
> >      System.out.println(e.toString());
> >      assertTrue(false);
> >     } finally {
> >       pm.close();
> >     }
> >
> > }
> >
> > the test passes. wenn i change the way of fetching the updated Object in
> the
> > test case like below, the test can not pass any more.
> >
> > public void testUpdate() {
> >
> > try {
> >
> > Date date = new Date();
> >                 Date date1 = new Date();
> >                 Long user_id = 1L;
> >       Workitem wi1 = new Workitem("test", 1, "tag", date, user_id);
> >       pm.makePersistent(wi1);
> >      Workitem wi2 = pm.detachCopy(wi1);
> >  wi2.setDescription("test1");
> > wi2.setTagString("tag1 tag2");
> >  wi2.setDuration(2);
> > wi2.setDate(date1);
> > wsi.update(wi2);
> >  Workitem wi3 = pm.getObjectById(Workitem.class, wi2.getId());
> > assertEquals(wi2.getId(), wi3.getId());
> >  assertEquals("test1", wi3.getDescription());
> > assertEquals(2, wi3.getDuration());
> >  assertEquals("tag1 tag2", wi3.getTagString());
> > assertEquals(date1, wi3.getDate());
> >      } catch (Exception e) {
> >      System.out.println(e.toString());
> >       assertTrue(false);
> >     } finally {
> >        pm.close();
> >     }
> >
> > }
> >
> > i did have do what Jason has said:
> >
> > change
> >
> > public String getRequestNamespace() {  return "gmail.com";
> >
> > }
> >
> > topublic String getRequestNamespace() {
> >   return "";
> >
> > }
> >
> > it doesn't work for me.
> >
> > so my question is: is there two different Datastore instances in the test
> > enviroment for GAE? or have i done something wrong?
> >
> > thanks in advance.
> >
> > ray
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to