34. Kind 、 Entity 、 Key 、 Property User 傳統關聯式資料庫 Datastore *Cloud Tu @TWJUG User Sport Null Null Favor2 Movie Null Null Favor3 Music Cloud 1 Music Tom 3 Null John 2 Favor1 Name PK Music Favor Cloud Name 1 Key John Name 2 Key Music , Sport , Movie Favor Tom Name 3 Key Kind Table Key PK Property Field Entity Row
39. JDO/Query Language public byte[] getPhoto(long id) { PersistenceManager pm = PMF.get().getPersistenceManager(); String query = "select from " + Photo.class.getName() + " where id == "+id; List<Photo> photos = (List<Photo>) pm.newQuery(query).execute(); if( photos.isEmpty() ) { pm.close(); return null; } Photo p = photos.get(0); Blob content = p.getContent(); byte[] b = content.getBytes(); pm.close(); return b; }
40.
41. EntityGroup User *Cloud Tu @TWJUG 自動產生 RootKey ParentKey Cloud Name 1 Key 自動產生 RootKey ParentKey John Name 2 Key 2 ParentKey Mary Name 3 Key 2 ParentKey Mary Name 4 Key 2 ParentKey Joe Name 5 Key A EntityGroup B EntityGroup