Ive implemented the stockwatcher application and have adjusted it so that it stores names and phone numbers. That all seems to be working ok, however Ive now implemented a "get" function which looks for a name, and returns a phone number. However, whats happening is that the first search i do returns nothing, then if i search for the same name again, then it returns the correct phone number, then if i search for another name, it returns the first name's phone instead.
eg I have the following data in the datastore: john 1111 paul 2222 i request the phone number for john and i get back "" I request the phone number for paul and i get back "1111" I request the phone number for john and i get back "2222" Client side Java file contains: private String GetOneContact(String Name) { ContactService = GWT.create(ContactService.class); ContactService.getoneContact(Name,new AsyncCallback<String>() { public void onFailure(Throwable error) { PhoneResult="ERROR"; } public void onSuccess(String Phone) { PhoneResult=Phone; } }); return (PhoneResult); } Server side (ContactServiceImpl.java) contains: public String getoneContact(String Name) throws NotLoggedInException { checkLoggedIn(); String Phone="x"; PersistenceManager pm = getPersistenceManager(); try { //Query q = pm.newQuery(Contact.class, "user == u && Name==n"); Query q = pm.newQuery(Contact.class, "user == u"); q.declareParameters("com.google.appengine.api.users.User u"); //q.declareParameters("John n"); List<Contact> Contacts = (List<Contact>) q.execute(getUser ()); for (Contact contact : Contacts) { if (Name.equals(contact.getName())) {Phone=contact.getPhone ();} } } finally { pm.close(); } return (Phone); } --~--~---------~--~----~------------~-------~--~----~ 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 google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---