Reputation: 1152
Key newwordKey = KeyFactory.createKey(NEWWORD_KEY_KIND, NEWWORD_KEY);
Entity newWord = new Entity(NEWWORD_ENTITY_KIND, newwordKey);
newWord.setProperty(USER_COL_USERNAME, userName);
newWord.setProperty(NEWWORD_COL, word);
datastore.put(newWord);
I mean I want to delete all "newword" Entity by its property "username" Ex, delete all words upload by user "Alexis" Any idea ? Thx
Upvotes: 0
Views: 128
Reputation: 1931
Use the Delete Entities by Query function:
Query q = pm.newQuery(NEWWORD_KIND.class);
q.setFilter("USER_COL_USERNAME == USR");
q.declareParameters("String USR");
q.deletePersistentAll("Alexis");
Hope this helps.
Upvotes: 1