Package org.hibernate

Examples of org.hibernate.Query.list()


  @SuppressWarnings("unchecked")
  public List<PrintTemplate> findAll() throws IOException {
    try {
      Query q = sessionFactory.getCurrentSession().createQuery("from PrintTemplate");
      return q.list();
    } catch (HibernateException e) {
      throw new IOException("find all print template names failed", e);
    }
  }
View Full Code Here


      if (doLog) start = System.currentTimeMillis();

      // old: li = this.getSession().find(query, value, type);
      Query qu = this.getSession().createQuery(query);
      qu.setParameter(0, value, type);
      li = qu.list();
     
      if (doLog) {
        long time = (System.currentTimeMillis() - start);
        logQuery("find (time "+time+", res " +(li == null? "null": ""+li.size())+")(trans "+trx.hashCode()+")", new Object[] {value}, new Type[] {type}, query)
      }
View Full Code Here

      long start = 0;
      if (doLog) start = System.currentTimeMillis();
      // old: li = getSession().find(query, values, types);
      Query qu = this.getSession().createQuery(query);
      qu.setParameters(values, types);
      li = qu.list();
     
     
      if (doLog) {
        long time = (System.currentTimeMillis() - start);
        logQuery("find (time "+time+", res " +(li == null? "null": ""+li.size())+")(trans "+trx.hashCode()+")", values, types, query)
View Full Code Here

      boolean doLog = Tracing.isDebugEnabled(DBManager.class);
      long start = 0;
      if (doLog) start = System.currentTimeMillis();
      // old: li = getSession().find(query);
      Query qu = this.getSession().createQuery(query);
      li = qu.list();

      if (doLog) {
        long time = (System.currentTimeMillis() - start);
        logQuery("find (time "+time+", res " +(li == null? "null": ""+li.size())+")(trans "+trx.hashCode()+")", null, null, query)
      }
View Full Code Here

    try {
      // old: deleted = getSession().delete(query, value, type);
      Session si = getSession();
      Query qu = si.createQuery(query);
      qu.setParameter(0, value, type);
      List foundToDel = qu.list();
      int deletionCount = foundToDel.size();
      for (int i = 0; i < deletionCount; i++ ) {
        si.delete( foundToDel.get(i) );
      }
      ////
View Full Code Here

      //old: deleted = getSession().delete(query, value, type);
     
      Session si = getSession();
      Query qu = si.createQuery(query);
      qu.setParameter(0, value, type);
      List foundToDel = qu.list();
      int deletionCount = foundToDel.size();
      for (int i = 0; i < deletionCount; i++ ) {
        si.delete( foundToDel.get(i) );
      }
     
View Full Code Here

    try {
      //old: deleted = getSession().delete(query, values, types);
      Session si = getSession();
      Query qu = si.createQuery(query);
      qu.setParameters(values, types);
      List foundToDel = qu.list();
      int deletionCount = foundToDel.size();
      for (int i = 0; i < deletionCount; i++ ) {
        si.delete( foundToDel.get(i) );
      }
     
View Full Code Here

            query.setParameterList("directories", directoryIds);
            if (prefs.getWithHeaderMacro() != null)
                query.setParameter("headerMacro", "%"+prefs.getWithHeaderMacro()+"%");
            query.setComment("retrieving documents for toc directory tree");

            List<WikiDocument> flatDocs = query.list();

            // Now attach the documents as payloads to the directories in the tree
            for (WikiDocument flatDoc : flatDocs) {

                Long directoryId = flatDoc.getParent().getId();
View Full Code Here

            tagQuery.setMaxResults(limit);
        }

        tagQuery.setResultTransformer(Transformers.aliasToBean(DisplayTagCount.class));

        return tagQuery.list();
    }

    public List<WikiFile> findWikFiles(WikiDirectory startDir, WikiFile ignoreFile, final String tag,
                                       WikiNode.SortableProperty orderBy, boolean orderAscending) {
View Full Code Here

        fileQuery.setParameterList("parentDirIds", wikiNodeDAO.findWikiDirectoryTreeIDs(startDir));
        if (ignoreFile != null && ignoreFile.getId() != null)
            fileQuery.setParameter("ignoreFile", ignoreFile);
        fileQuery.setParameter("tag", tag);

        return fileQuery.list();
    }

    private Session getSession() {
        return ((Session)((org.jboss.seam.persistence.EntityManagerProxy) restrictedEntityManager).getDelegate());
    }
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.