Sophie Sepp
Sophie Sepp

Reputation: 551

Entities not found in App Engine Datastore

I`m working with App Engine and create Entities with the following code:

DatastoreService service;
service = DatastoreServiceFactory.getDatastoreService();
String kind = Hashing.md5().hashString(input).toString();
Key EntityKey = KeyFactory.createKey("kind", kind);
String result = queryResult.toString();

Text text = new Text(result);
Text text2 = new Text(input); 

Entity entity = new Entity(EntityKey);

entity.setProperty("result", text);
entity.setProperty("query", text2);
entity.setProperty("jobId", completedJobId);

System.out.println(entity);

service.put(entity);

When I try to get the entities by key, there are sometimes cases where the entities are not found after I deployed to app engine, although they are found when I run the app locally. Even more strange is, some entities are found after deploying that are not found locally. What is the problem here?

Upvotes: 0

Views: 373

Answers (1)

Lipis
Lipis

Reputation: 21835

What is happening locally has nothing to do with the deployed version. These are two different things. The whole idea is that you can test/experiment locally without affecting the production server and when everything is ready you can deploy. Also when you are testing it online (or actually working on it) is not affecting the local datastore. You can also very easily clean and start over when working locally, while doing that on production server might affect a lot of users if it's an application that is being used by more than one person.

Upvotes: 1

Related Questions