OK I looked it up, more info here 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Long.html
for anyone else who wants to know...

and I can actually use the following:

(StoredID.compareTo(ID)==0)
StoredID.equals(ID)

Cheers,
J

On Oct 21, 3:44 am, nclemeur <nclem...@gmail.com> wrote:
> 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 VDenley<johnvden...@googlemail.com> 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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to