How to retrieve Google Appengine Objects by id (Long value) ?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-05-30T14:16:43Z Indexed on 2010/05/30 14:22 UTC
Read the original article Hit count: 204

Hi,

i have declared an entity the following way:

public class MyEntity {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
    @Persistent
    private String text;
        //getters and setters
}

Now I want to retrieve the objects using the id. I tried to manage it from the Google Appengine Data Viewer with "SELECT * FROM MyEntity Where id = 382005" or via a query in a servlet. I get no results returned. But i know for sure that the object with the id exists (i made a jsp which queries all objects in the db and displays them in the db).

So what is wrong in my query? Am I querying the wrong field? The Google Appengine Data Viewer names the field "ID/name" and it has the value "id=382005". Do I have to query with this names? I've tried but it didn't work out :(

© Stack Overflow or respective owner

Related posts about query

Related posts about google-app-engine