Monday, May 14, 2012

How to convert com.google.appengine.api.datastore.Entity to my Entity Object?

Why I get an casting error when I try to get some database object using com.google.appengine.api.datastore.Query



For example:
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Query q = new Query("User");



PreparedQuery pq = datastore.prepare(q);

for (Entity entity : pq.asIterable()) {
User myUser = (User)entity;
}




No comments:

Post a Comment