You will also find that all integral numbers are converted to Long and all collections are converted to ArrayList. The low-level api is powerful but a little quirky; this is why folks built Objectify, Twig, SimpleDS, and Slim3.
Jeff On Tue, Jul 20, 2010 at 8:29 AM, Jeff Schwartz <[email protected]> wrote: > Entity is an expando and that is indeed the way they work. > > On Tue, Jul 20, 2010 at 5:32 AM, Marc Hacker <[email protected]> wrote: >> >> Surely this is not intended! Entity.getProperty() gives exactly the >> same result, null, if there is no property, there is a property set to >> null or there is an empty Collection! >> >> >> DatastoreService datastore = >> DatastoreServiceFactory.getDatastoreService(); >> Key key = KeyFactory.createKey("testKind", "testKey"); >> Entity e = new Entity(key); >> e.setProperty("null", null); >> e.setProperty("emptylist", new ArrayList<String>()); >> datastore.put(e); >> try { >> Entity e2 = datastore.get(key); >> System.out.println(e2.getProperty("null")==null); >> >> System.out.println(e2.getProperty("emptylist")==null); >> >> System.out.println(e2.getProperty("doesNotExist")==null); >> } catch (EntityNotFoundException exc) { >> exc.printStackTrace(); >> } >> Result: >> true >> true >> true >> >> At the very least an empty list should be saved as an empty list no? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-appengine?hl=en. >> > > > > -- > -- > Jeff > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
