Package javax.jdo

Examples of javax.jdo.PersistenceManager.newQuery()


            "(SELECT AVG(e.weeklyhours) FROM " + Employee.class.getName() + " e)";

        // create subquery instance using different pm
        PersistenceManager newPM =
            pm.getPersistenceManagerFactory().getPersistenceManager();
        Query sub = newPM.newQuery(Employee.class);
        sub.setResult("avg(this.weeklyhours)");

        Query apiQuery = pm.newQuery(Employee.class);
        apiQuery.setFilter("this.weeklyhours> averageWeeklyhours");
        apiQuery.addSubquery(sub, "double averageWeeklyhours", null);
View Full Code Here


      // First get the expired contracts that have not been archived yet
      // Get the prices and archive them
      query = "SELECT FROM " + Contract.class.getName() + " WHERE expiryDate>0 && archived==false ORDER BY expiryDate";
      print(query);
      PersistenceManager pm = PMF.get().getPersistenceManager();
      Query q = pm.newQuery(query);
      Queue queue = QueueFactory.getDefaultQueue();
      @SuppressWarnings("unchecked")
      List<Contract> results = (List<Contract>) q.execute();
      print("Putting in queue for processing " + results.size() + " contracts.");
      for (Contract c : results) {
View Full Code Here

      long now = (new Date()).getTime();
      query = "SELECT FROM " + Contract.class.getName() + " WHERE laststoredCSV<" + (now - Contract.time_threshold())
          + " && expiryDate==0 && archived==false  ORDER BY laststoredCSV";
      print(query);
      pm = PMF.get().getPersistenceManager();
      q = pm.newQuery(query);

      @SuppressWarnings("unchecked")
      List<Contract> results_remaining = (List<Contract>) q.execute();

      print("Putting in queue for processing " + results_remaining.size() + " contracts.");
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Config getConfig() throws IOException {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      String query = "select from " + Config.class.getName();
      List<Config> configs = (List<Config>) pm.newQuery(query).execute();
      if (configs.size() > 0) {
        Config config = configs.get(0);
        return pm.detachCopy(config);
      }
    } catch (Exception e) {
View Full Code Here

    DataManager dm = DataManagerFactory.getInstance();
    PersistenceManager pm = dm.newPersistenceManager();

    // fetch user
    Query qUser = pm.newQuery(talkfeed.data.User.class);
    qUser.setFilter("id == param");
    qUser.declareParameters("String param");
    qUser.setUnique(true);
    qUser.setRange(0, 1);
    talkfeed.data.User talkfeedUser = (talkfeed.data.User) qUser
View Full Code Here

    if (talkfeedUser != null) {
      // key from user
      Key key = talkfeedUser.getKey();

      // list subscription
      Query qSub = pm.newQuery(Subscription.class);
      qSub.setFilter("userKey == bk");
      qSub.declareParameters("com.google.appengine.api.datastore.Key bk");

      @SuppressWarnings("unchecked")
      List<Subscription> subs = (List<Subscription>) qSub.execute(key);
View Full Code Here

  public ModelAndView ajaxLastEntries(long blogId) {
    DataManager dm = DataManagerFactory.getInstance();
    PersistenceManager pm = dm.newPersistenceManager();

    // select subscriptions
    Query q = pm.newQuery(BlogEntry.class);
    q.setOrdering("pubDate desc");
    q.setRange(0, 15);

    q.setFilter("blogKey == bk");
    q.declareParameters("com.google.appengine.api.datastore.Key bk");
View Full Code Here

   
    DataManager dm = DataManagerFactory.getInstance();
   
    PersistenceManager pm = dm.newPersistenceManager();
   
    Query q = pm.newQuery(Blog.class);
   
    //fetch ALL blogs
    @SuppressWarnings("unchecked")
    List<Blog> allBlogs = (List<Blog>) q.execute();
   
View Full Code Here

    @SuppressWarnings("unchecked")
    List<Blog> allBlogs = (List<Blog>) q.execute();
   
    for(Blog b : allBlogs){
      //fetch sub
      Query sq = pm.newQuery(Subscription.class);
      sq.setFilter("blogKey == bk");
      sq.declareParameters("com.google.appengine.api.datastore.Key bk");
      sq.setRange(0, 1);
     
      @SuppressWarnings("unchecked")
View Full Code Here

   
    DataManager dm = DataManagerFactory.getInstance();
   
    PersistenceManager pm = dm.newPersistenceManager();
   
    Query q = pm.newQuery(BlogEntry.class);
    q.setFilter("creaDate < date");
    q.setRange(0,50);
    q.declareParameters("java.util.Date date");
   
    Calendar cdat = Calendar.getInstance();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.