org.springframework.orm.hibernate3.HibernateCallback Java Examples

The following examples show how to use org.springframework.orm.hibernate3.HibernateCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSearchDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
private int countAdvanced (final String sid)
{
   return dao.getHibernateTemplate ().execute (
      new HibernateCallback<Integer> ()
      {
         @Override
         public Integer doInHibernate (Session session)
            throws HibernateException, SQLException
         {
            String hql =
               "SELECT count(*) FROM SEARCH_ADVANCED WHERE SEARCH_UUID = ?";
            SQLQuery query = session.createSQLQuery (hql);
            query.setString (0, sid);
            return ((BigInteger) query.uniqueResult ()).intValue ();
         }
      });
}
 
Example #2
Source File: StudentDaoImpl.java    From OnLineTest with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param hql传入的hql语句
 * @param pageCode当前页
 * @param pageSize每页显示大小
 * @return
 */
public List doSplitPage(final String hql,final int pageCode,final int pageSize){
    //调用模板的execute方法,参数是实现了HibernateCallback接口的匿名类,
    return (List) this.getHibernateTemplate().execute(new HibernateCallback(){
        //重写其doInHibernate方法返回一个object对象,
        public Object doInHibernate(Session session)
                throws HibernateException, SQLException {
            //创建query对象
            Query query=session.createQuery(hql);
            //返回其执行了分布方法的list
            return query.setFirstResult((pageCode-1)*pageSize).setMaxResults(pageSize).list();
             
        }
         
    });
     
}
 
Example #3
Source File: BorrowDaoImpl.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param hql传入的hql语句
 * @param pageCode当前页
 * @param pageSize每页显示大小
 * @return
 */
public List doSplitPage(final String hql,final int pageCode,final int pageSize){
    //调用模板的execute方法,参数是实现了HibernateCallback接口的匿名类,
    return (List) this.getHibernateTemplate().execute(new HibernateCallback(){
        //重写其doInHibernate方法返回一个object对象,
        public Object doInHibernate(Session session)
                throws HibernateException, SQLException {
            //创建query对象
            Query query=session.createQuery(hql);
            //返回其执行了分布方法的list
            return query.setFirstResult((pageCode-1)*pageSize).setMaxResults(pageSize).list();
             
        }
         
    });
     
}
 
Example #4
Source File: BackDaoImpl.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
public List doLimitBackInfo(final String hql,final int pageCode,final int pageSize){
    //调用模板的execute方法,参数是实现了HibernateCallback接口的匿名类,
    return (List) this.getHibernateTemplate().execute(new HibernateCallback(){
        //重写其doInHibernate方法返回一个object对象,
        public Object doInHibernate(Session session)
                throws HibernateException, SQLException {
            //创建query对象
        	SQLQuery query=session.createSQLQuery(hql);
            //返回其执行了分布方法的list
            return query.setFirstResult((pageCode-1)*pageSize).setMaxResults(pageSize).list();
             
        }
         
    });
     
}
 
Example #5
Source File: ProductInfoDaoImpl.java    From CompanyWebsite with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param hql传入的hql语句
 * @param pageCode当前页
 * @param pageSize每页显示大小
 * @return
 */
public List doSplitPage(final String hql, final int pageCode,
		final int pageSize) {
	// 调用模板的execute方法,参数是实现了HibernateCallback接口的匿名类,
	return (List) this.getHibernateTemplate().execute(
			new HibernateCallback() {
				// 重写其doInHibernate方法返回一个object对象,
				public Object doInHibernate(Session session)
						throws HibernateException, SQLException {
					// 创建query对象
					Query query = session.createQuery(hql);
					// 返回其执行了分布方法的list
					return query.setFirstResult((pageCode - 1) * pageSize)
							.setMaxResults(pageSize).list();

				}

			});

}
 
Example #6
Source File: ProfileDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
/**
 * Counts the number of Targets, and Target Groups
 * @param aProfile The profile to count.
 * @return The number of targets or groups using that profile.
 */
public int countProfileUsage(final Profile aProfile) {
	return (Integer) getHibernateTemplate().execute(
			new HibernateCallback() {
				public Object doInHibernate(Session session) {						
					int targetCount = (Integer) session.createCriteria(AbstractTarget.class)
									.setProjection(Projections.rowCount())
									.createCriteria("profile")
									.add(Restrictions.eq("oid", aProfile.getOid()))
									.uniqueResult();
					
					targetCount += (Integer) session.createCriteria(TargetInstance.class)
					.setProjection(Projections.rowCount())
					.createCriteria("lockedProfile")
					.add(Restrictions.eq("origOid", aProfile.getOrigOid()))
					.add(Restrictions.eq("version", aProfile.getVersion()))
					.uniqueResult();
	
					return targetCount;
				}
			}
		);	
	
}
 
Example #7
Source File: ScoreDaoImpl.java    From OnLineTest with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param hql传入的hql语句
 * @param pageCode当前页
 * @param pageSize每页显示大小
 * @return
 */
public List doSplitPage(final String hql,final int pageCode,final int pageSize){
    //调用模板的execute方法,参数是实现了HibernateCallback接口的匿名类,
    return (List) this.getHibernateTemplate().execute(new HibernateCallback(){
        //重写其doInHibernate方法返回一个object对象,
        public Object doInHibernate(Session session)
                throws HibernateException, SQLException {
            //创建query对象
            Query query=session.createQuery(hql);
            //返回其执行了分布方法的list
            return query.setFirstResult((pageCode-1)*pageSize).setMaxResults(pageSize).list();
             
        }
         
    });
     
}
 
Example #8
Source File: FileScannerDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
public int deleteCollectionReferences(final Collection collection)
{
   return getHibernateTemplate().execute  (
      new HibernateCallback<Integer>()
      {
         public Integer doInHibernate(Session session) 
            throws HibernateException, SQLException
         {
            String sql = "DELETE FROM FILESCANNER_COLLECTIONS s " +
                     " WHERE s.COLLECTIONS_UUID = :cid";
            SQLQuery query = session.createSQLQuery(sql);
            query.setString ("cid", collection.getUUID());
            return query.executeUpdate ();
         }
      });
}
 
Example #9
Source File: TargetDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
public int countTargets(final String username) {
	return (Integer) getHibernateTemplate().execute(
			new HibernateCallback() {
				public Object doInHibernate(Session session) {						
					Criteria query = session.createCriteria(Target.class);
					Criteria ownerCriteria = null;
					query.setProjection(Projections.rowCount());
					if(!Utils.isEmpty(username)) {
						ownerCriteria = query.createCriteria("owner").add(Restrictions.eq("username", username));
					}
					
					Integer count = (Integer) query.uniqueResult();
	                
	                return count;
				}
			}
		);	
}
 
Example #10
Source File: ProductCartDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Removes all the references of one product from all the existing carts.
 * @param product the product to be removed from carts.
 */
public void deleteProductReferences(final Product product)
{
   getHibernateTemplate().execute  (
      new HibernateCallback<Void>()
      {
         public Void doInHibernate(Session session) 
            throws HibernateException, SQLException
         {
            session.createSQLQuery(
               "DELETE FROM CART_PRODUCTS p " +
               " WHERE p.PRODUCT_ID = :pid").
               setParameter ("pid", product.getId()).executeUpdate ();
            return null;
         }
      });
}
 
Example #11
Source File: NetworkUsageDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
public int countDownloadByUserSince (final User user, final Date date)
{
   Long result =
         getHibernateTemplate ().execute (new HibernateCallback<Long> ()
         {
            @Override
            public Long doInHibernate (Session session)
                  throws HibernateException, SQLException
            {
               Criteria criteria = session.createCriteria (
                     NetworkUsage.class);
               criteria.setProjection (Projections.rowCount ());
               criteria.add (Restrictions.eq ("isDownload", true));
               criteria.add (Restrictions.eq ("user", user));
               criteria.add (Restrictions.gt ("date", date));
               return (Long) criteria.uniqueResult ();
            }
         });
   return (result != null) ? result.intValue () : 0;
}
 
Example #12
Source File: NetworkUsageDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
public long getDownloadedSizeByUserSince (final User user, final Date date)
{
   Long result =
         getHibernateTemplate ().execute (new HibernateCallback<Long> ()
         {
            @Override
            public Long doInHibernate (Session session)
                  throws HibernateException, SQLException
            {
               Criteria criteria = session.createCriteria (
                     NetworkUsage.class);
               criteria.setProjection (Projections.sum ("size"));
               criteria.add (Restrictions.eq ("isDownload", true));
               criteria.add (Restrictions.eq ("user", user));
               criteria.add (Restrictions.gt ("date", date));
               return (Long) criteria.uniqueResult ();
            }
         });
   return (result == null) ? 0 : result;
}
 
Example #13
Source File: SearchDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void delete (final Search search)
{
   getHibernateTemplate ().execute (new HibernateCallback<Void>()
   {
      @Override
      public Void doInHibernate (Session session) throws HibernateException,
         SQLException
      {
         String sql = "DELETE FROM SEARCH_PREFERENCES WHERE SEARCHES_UUID = ?";
         Query query = session.createSQLQuery (sql);
         query.setString (0, search.getUUID ());
         query.executeUpdate ();
         return null;
      }
   });
   super.delete (search);
}
 
Example #14
Source File: ProductDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
public List<Product> scrollUploadedProducts (final User user, final int skip,
   final int top)
{
   checkProductNumber (top);
   return getHibernateTemplate ().execute (
         new HibernateCallback<List<Product>>()
   {
      @Override
      @SuppressWarnings ("unchecked")
      public List<Product> doInHibernate (Session session)
         throws HibernateException, SQLException
      {
         String hql = "SELECT p FROM Product p, User u" +
                  " WHERE p.owner = u and u.uuid like ? AND p.processed = true";
         Query query = session.createQuery (hql);
         query.setString (0, user.getUUID ());
         query.setFirstResult (skip);
         query.setMaxResults (top);
         return (List<Product>) query.list ();
      }
   });
}
 
Example #15
Source File: AccessRestrictionDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void deleteAll ()
{
   getHibernateTemplate ().execute (new HibernateCallback<Void> ()
   {
      @Override
      public Void doInHibernate (Session session)
            throws HibernateException, SQLException
      {
         SQLQuery query =
               session.createSQLQuery ("DELETE FROM USER_RESTRICTIONS");
         query.executeUpdate ();
         query = session.createSQLQuery ("DELETE  FROM ACCESS_RESTRICTION");
         query.executeUpdate ();
         return null;
      }
   });
}
 
Example #16
Source File: TargetInstanceDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
public int countTargetInstancesByTarget(final Long targetOid) {
	return (Integer) getHibernateTemplate().execute(
		new HibernateCallback() {
			public Object doInHibernate(Session session) {					
				Criteria query = session.createCriteria(TargetInstance.class);
				query.setProjection(Projections.rowCount());
									
				query.createCriteria("target").add(Restrictions.eq("oid", targetOid));

				Integer count = (Integer) query.uniqueResult();
                
                return count;
			}
		}
	);	
}
 
Example #17
Source File: TestProductDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
private int countElements (final String table, final Long pid)
{
   return dao.getHibernateTemplate ().execute (
         new HibernateCallback<Integer> ()
         {
            @Override
            public Integer doInHibernate (Session session)
                  throws HibernateException, SQLException
            {
               String sql =
                     "SELECT count(*) FROM " + table +
                           " WHERE PRODUCT_ID = ?";
               Query query = session.createSQLQuery (sql).setLong (0, pid);
               return ((BigInteger) query.uniqueResult ()).intValue ();
            }
         });
}
 
Example #18
Source File: TestUserDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
private int countInTable (final String table, final String IdName,
   final String uuid)
{
   return dao.getHibernateTemplate ().execute (
      new HibernateCallback<Integer> ()
      {
         @Override
         public Integer doInHibernate (Session session)
            throws HibernateException, SQLException
         {
            String sql =
               "SELECT count(*) FROM " + table + " WHERE " + IdName + " = ?";
            Query query = session.createSQLQuery (sql);
            query.setString (0, uuid);
            return ((BigInteger) query.uniqueResult ()).intValue ();
         }
      });
}
 
Example #19
Source File: TestUserDao.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
private int countRestriction (final User user)
{
   return dao.getHibernateTemplate ().execute (
      new HibernateCallback<Integer> ()
      {
         @Override
         public Integer doInHibernate (Session session)
            throws HibernateException, SQLException
         {
            String sql =
               "SELECT count(*) FROM ACCESS_RESTRICTION "
                  + "WHERE UUID IN (:restriction)";
            Query query = session.createSQLQuery (sql);
            query.setParameterList ("restriction", user.getRestrictions ());
            return ((BigInteger) query.uniqueResult ()).intValue ();
         }
      });
}
 
Example #20
Source File: BaseDAO.java    From QiQuYingServer with Apache License 2.0 6 votes vote down vote up
/**
 * @Title: countByExample
 * @Description: 根据模型统计
 * @param @param entityBean
 * @param @return
 * @return int
 */
public <T> int countByExample(final T obj) {
	return (Integer) getHibernateTemplate().executeWithNativeSession(new HibernateCallback<Integer>() {
		public Integer doInHibernate(Session s) throws HibernateException, SQLException {
			// 组装属性
			Criteria criteria = s.createCriteria(obj.getClass()).setProjection(Projections.projectionList().add(Projections.rowCount()))
					.add(Example.create(obj));
			if (getHibernateTemplate().isCacheQueries()) {
				criteria.setCacheable(true);
				if (getHibernateTemplate().getQueryCacheRegion() != null)
					criteria.setCacheRegion(getHibernateTemplate().getQueryCacheRegion());
			}
			if (getHibernateTemplate().getFetchSize() > 0)
				criteria.setFetchSize(getHibernateTemplate().getFetchSize());
			if (getHibernateTemplate().getMaxResults() > 0)
				criteria.setMaxResults(getHibernateTemplate().getMaxResults());
			SessionFactoryUtils.applyTransactionTimeout(criteria, getSessionFactory());
			return (Integer) criteria.uniqueResult();
		}
	});
}
 
Example #21
Source File: TargetDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public Set<Long> getImmediateChildrenOids(final Long parentOid) {
   	if(parentOid == null) {
   		return Collections.EMPTY_SET;
   	}
   	else {
    	List<Long> immediateChildren = getHibernateTemplate().executeFind(new HibernateCallback() {
			public Object doInHibernate(Session aSession) throws HibernateException, SQLException {
				//Criteria q = aSession.createCriteria("new java.lang.Long(oid) FROM TargetGroup").createCriteria("children").add(Restrictions.eq("oid", childOid));
				Query q = aSession.createQuery("SELECT new java.lang.Long(gm.child.oid) FROM GroupMember gm where gm.parent.oid = :parentOid");
				q.setLong("parentOid", parentOid);
				return q.list();
			}
    	});
   	
    	Set<Long> retval = new HashSet<Long>();
    	retval.addAll(immediateChildren);
    	return retval;
   	}
   }
 
Example #22
Source File: TargetDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
/**
 * Find all the groups that need to be end dated.
 * @return A List of groups to be end dated.
 */
@SuppressWarnings("unchecked")
public List<TargetGroup> findEndedGroups() {
	return getHibernateTemplate().executeFind(new HibernateCallback() {
		public Object doInHibernate(Session aSession) throws HibernateException, SQLException {
			List<TargetGroup> results = aSession.createCriteria(TargetGroup.class)
				.add(Restrictions.ne("state", TargetGroup.STATE_ACTIVE))
				.add(Restrictions.lt("toDate", new Date()))
				.setFetchMode("schedules", FetchMode.JOIN)
				.setFetchMode("parents", FetchMode.JOIN)
				.setFetchMode("children", FetchMode.JOIN)
				.list();
			
			log.debug("Found " + results.size() + " groups that need to be unscheduled");
			
			return results;
		}
	});
}
 
Example #23
Source File: BaseDAO.java    From QiQuYingServer with Apache License 2.0 6 votes vote down vote up
/**
 * @Title: executeSQLQuery
 * @Description: 执行SQL查询,多个参数调用
 * @param @param sql
 * @param @param params
 * @param @return
 * @return List<T>
 */
public <T> PageResult<T> executeSQLQuery(final String sql, final Class<T> clazz, final Limit limit, final Object... params) {
	String countSql = this.getCountSql(sql);
	List<T> list = (List<T>) getHibernateTemplate().execute(new HibernateCallback<List<T>>() {
		public List<T> doInHibernate(Session session) throws HibernateException, SQLException {
			SQLQuery query = session.createSQLQuery(sql);
			query.addEntity(clazz);
			query.setMaxResults(limit.getSize());
			query.setFirstResult(limit.getStart());
			buildParameters(query, params);
			return query.list();
		}
	});
	BigInteger bigTotalCount = this.getUniqueSQLResult(countSql, params);
	return new PageResult<T>(bigTotalCount.intValue(), limit, list);
}
 
Example #24
Source File: TargetInstanceDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
/** @see TargetInstanceDAO#deleteHarvestResources(Long targetInstanceId). */
public void deleteHarvestResources(final Long targetInstanceId) 
{
	getHibernateTemplate().execute(new HibernateCallback() {
		public Object doInHibernate(Session aSession) {
					
			List<HarvestResult> hrs = getHarvestResults(targetInstanceId);
			Iterator<HarvestResult> it = hrs.iterator();
			while(it.hasNext())
			{
				final HarvestResult hr = it.next();
				getHibernateTemplate().initialize(hr);
				//delete all the associated resources
				if(hr.getResources() != null)
				{
					deleteHarvestResultResources(hr.getOid()); 
				}
			}
			return null;
		}     
		});
}
 
Example #25
Source File: TargetDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public List<Integer> getSavedMemberStates(final TargetGroup aTargetGroup) {
	if(aTargetGroup.isNew()) {
		return new LinkedList<Integer>();
	}
	else {
		return (List<Integer>) getHibernateTemplate().execute(
				new HibernateCallback() {
					@SuppressWarnings("unchecked")
					public Object doInHibernate(Session session) {
						Query q = session.getNamedQuery(GroupMember.QUERY_GET_MEMBERSTATES);
						q.setLong("parentOid", aTargetGroup.getOid());
						List<Integer> states = q.list();
						
						return states;
					}
				}
			);			
	}		
}
 
Example #26
Source File: TargetInstanceDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
/**
 * Detect and update TargetGroups that must be made inactive due to their
 * end date having been passed.
 */
public void endDateGroups() {
	Date startTime = new Date();
	log.info("Starting Job to check end dates on groups");
	
	getHibernateTemplate().execute(new HibernateCallback() {
		@SuppressWarnings("unchecked")
		public Object doInHibernate(Session aSession) throws HibernateException, SQLException {
			List<TargetGroup> groupsToEnd = aSession.createCriteria(TargetGroup.class)
				.add(Restrictions.ne("state", TargetGroup.STATE_INACTIVE))
				.add(Restrictions.lt("toDate", new Date()))
				.list();
			
			for(TargetGroup group : groupsToEnd) {
				deleteScheduledInstances(group);
				group.changeState(TargetGroup.STATE_INACTIVE);
			}
			
			return null;
		}
		
	});
	
	log.info("Completed Job to check end dates on group: took " + (new Date().getTime() - startTime.getTime()) + "ms");	
}
 
Example #27
Source File: BaseDAO.java    From QiQuYingServer with Apache License 2.0 6 votes vote down vote up
/**
 * @Title: getUniqueSQLResultByHql
 * @Description: 查找唯一结果集,多个参数形式
 * @param @param hql
 * @param @param objs
 * @param @return
 * @return Object
 */
public <T> T getUniqueSQLResult(final String sql, final Class<T> objClass, final Object... params) {
	return (T) getHibernateTemplate().execute(new HibernateCallback<T>() {
		public T doInHibernate(Session session) throws HibernateException, SQLException {
			String limitSql = sql;
			if (!sql.contains("limit")) {
				limitSql += " limit 1";
			}
			Query query = null;
			if (null != objClass) {
				query = session.createSQLQuery(limitSql).addEntity("bean", objClass);
			} else {
				query = session.createSQLQuery(limitSql);
			}
			buildParameters(query, params);
			return (T) query.uniqueResult();
		}
	});
}
 
Example #28
Source File: AnnotationDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
/**
 * @see org.webcurator.domain.AnnotationDAO#loadAnnotations(java.lang.String, java.lang.Long)
 */
public List<Annotation> loadAnnotations(final String aType, final Long aOid) {
	if (log.isDebugEnabled()) {
		log.debug("Load annotations for " + aType + " " + aOid);
	}
	Object obj = getHibernateTemplate().execute(new HibernateCallback() {
		public Object doInHibernate(Session aSession) throws HibernateException, SQLException {
			Query q = aSession.getNamedQuery(Annotation.QRY_GET_NOTES);
			q.setString(Annotation.PARAM_TYPE, aType);
			q.setLong(Annotation.PARAM_OID, aOid);
			
			return q.list();
		}
	});			
       
       return (List<Annotation>) obj;
}
 
Example #29
Source File: TargetInstanceDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
  public List<QueuedTargetInstanceDTO> getUpcomingJobs(final long futureMs) {
return (List) getHibernateTemplate().execute(
	new HibernateCallback() {
		public Object doInHibernate(Session session) {
			
			StringBuffer q = new StringBuffer();
			q.append("select new org.webcurator.domain.model.dto.QueuedTargetInstanceDTO(ti.oid, ti.scheduledTime, ti.priority, ti.state, ti.bandwidthPercent, ti.owner.agency.name) ");
			q.append("from TargetInstance ti where ti.scheduledTime <= :ed ");
			q.append("and ti.state in ('Scheduled', 'Queued') ");
			q.append("order by ti.priority asc, ti.scheduledTime asc, ti.oid asc ");
			
			Query query = session.createQuery(q.toString());
			
			query.setTimestamp("ed", new Date(System.currentTimeMillis()+futureMs));
			
			return query.list();
		}
	}
);				   
  }
 
Example #30
Source File: TargetDAOImpl.java    From webcurator with Apache License 2.0 6 votes vote down vote up
public Pagination getNonSubGroupDTOs(final String name, final String subGroupType, final int pageNumber, final int pageSize) {
	return (Pagination) getHibernateTemplate().execute(
			new HibernateCallback() {
				public Object doInHibernate(Session session) {
					
					Query q = session.getNamedQuery(AbstractTargetGroupTypeView.QUERY_NON_SUBGROUP_DTOS_BY_NAME_AND_TYPE);
					Query cq = session.getNamedQuery(AbstractTargetGroupTypeView.QUERY_CNT_NON_SUBGROUP_DTOS_BY_NAME_AND_TYPE);
					q.setParameter("name", name);
					q.setParameter("subgrouptype", subGroupType);
					cq.setParameter("name", name);
					cq.setParameter("subgrouptype", subGroupType);

					return new Pagination(cq, q, pageNumber, pageSize);
				}
			}
		);	
}