I have a very simple hello world application on Google Cloud with objectify.
I am using the latest Google Cloud Tools (1.6.1) for eclipse (Oxygen 4.7.3a), Java 8, and running the datastore emulator (as described in Elliotte's answer)
I was able to save some entities and I can tell they are persisted because I can retrieve them after restart the emulator and I know they are stored under: "C:\Users\XXXX\AppData\Roaming\gcloud\emulators\datastore\WEB-INF\appengine-generated"
BUT I couldn't find these entities in the datastore view under any namespace. Any idea what am I missing here?
The code:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
Car porsche = new Car("2FAST", 4);
ofy().save().entity(porsche).now(); // async without the now()
assert porsche.id != null; // id was autogenerated
Car fetched2 = ofy().load().type(Car.class).id(porsche.id).now();
Query cars = ofy().load().type(Car.class).chunkAll();
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
response.getWriter().print("Hello App Engine!\r\n");
response.getWriter().print(fetched2.id + " " + fetched2.license);
response.getWriter().print("\ncars.count():" + cars.count() + "\n");
List carsList = cars.list();
for(Car c :carsList) {
response.getWriter().println(c.id + " " + c.license);
}
String namespace = NamespaceManager.get();
response.getWriter().println();
response.getWriter().println("namespace: ");
}
The run configuration: