Just use
 StoredID.equals(ID)

These are objects in Java, so you need to use equals (or
StoreID.longValue==ID.longValue)

Cheers

Nicolas

On Oct 21, 12:39 pm, John V Denley <[email protected]> wrote:
> OK so Im sending in an ID number (Long) and Im doing a query on the
> datastore, getting all the "contacts" in the database, using the
> "getID" function to get the "StoredID" and comparing the ID's.
>
> However for some reason the boolean "test" below never becomes true,
> despite after stepping through the program there are times when
> StoredID=16 and ID=16, but yet (StoredID==ID) does not evaluate to
> "true"
>
> anyone got any ideas?
>
>   public String updateContact(Long AdminID, Long ID, String
> Name,String Phone, String KnownAs, String Notes) throws
> NotLoggedInException {
>
>             Contact ContactToUpdate=null;
>             Long StoredID;
>
>             PersistenceManager pm = PMF.get().getPersistenceManager();
>             try {
>               Query q = pm.newQuery(Contact.class, "AdminID == AID");
>               q.declareParameters("Long AID");
>               List<Contact> Contacts = (List<Contact>) q.execute(AdminID);
>               for (Contact contact : Contacts)
>               {
>
>                   StoredID=contact.getID();
>                   boolean test=(StoredID==ID);
>                   if (test)
>                   {
>                           ContactToUpdate=contact;
>                   }
>                   else
>                   {
>                           ContactToUpdate=null;
>                   }
>              }
>          }
>          finally
>          {
>               pm.close();
>          }
>       }
--~--~---------~--~----~------------~-------~--~----~
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