Пример #1
0
 public static void deleteAllAccesses(List<Access> list) {
   PersistenceManager pm = PMF.get().getPersistenceManager();
   try {
     pm.deletePersistentAll(list);
   } finally {
     pm.close();
   }
 }
Пример #2
0
  private void deleteToken(String screenName, User user) {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    Query query = pm.newQuery(TwitterAccount.class);
    query.setFilter("twitterScreenName == screenVar && user == userVar");
    query.declareParameters("String screenVar,  com.google.appengine.api.users.User userVar");
    @SuppressWarnings("unchecked")
    List<TwitterAccount> twitterAccounts = (List<TwitterAccount>) query.execute(screenName, user);
    pm.deletePersistentAll(twitterAccounts);
    query.closeAll();

    query = pm.newQuery(TwitterStatus.class);
    query.setFilter("twitterScreenName == screenVar && user == userVar");
    query.declareParameters("String screenVar,  com.google.appengine.api.users.User userVar");
    @SuppressWarnings("unchecked")
    List<TwitterStatus> twitterStatus = (List<TwitterStatus>) query.execute(screenName, user);
    pm.deletePersistentAll(twitterStatus);

    // TODO delete all related transactions

    query.closeAll();
    pm.close();
  }
  @Override
  public void deleteAll() {
    PersistenceManager pm = getPersistenceManager();

    pm.deletePersistentAll(findAll());
  }