当前位置: 首页>>代码示例>>Java>>正文


Java Order类代码示例

本文整理汇总了Java中org.hibernate.criterion.Order的典型用法代码示例。如果您正苦于以下问题:Java Order类的具体用法?Java Order怎么用?Java Order使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Order类属于org.hibernate.criterion包,在下文中一共展示了Order类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showBookByDynasty

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
public Pager<Book> showBookByDynasty(String dynasty, int pageNo,int pageSize) {
	System.out.println("-----执行到BookDaoImpl");
	
	Session session = sessionFactory.getCurrentSession();
	Criteria criteria = session.createCriteria(Book.class);
	criteria.add(Restrictions.eq("dynasty", dynasty));
	long recordTotal = ((Long) criteria.setProjection(Projections.rowCount()).uniqueResult()).longValue();
	criteria.setProjection(null);
	criteria.addOrder(Order.desc("clickTimes"));
	criteria.setFirstResult((pageNo - 1) * pageSize);
	criteria.setMaxResults(pageSize);
	List<Book> results = criteria.list();
	Pager<Book> page=new Pager<Book>(pageSize, pageNo, recordTotal, results);
	return page;
	
}
 
开发者ID:zhangjikai,项目名称:sdudoc,代码行数:18,代码来源:BookDaoImpl.java

示例2: pagedQuery

import org.hibernate.criterion.Order; //导入依赖的package包/类
/**
 * 分页查询函数,根据entityClass和page参数进行查询.
 * 
 * @param <T>
 *            实体类型
 * @param entityClass
 *            实体类型
 * @param page
 *            分页里包含的各种参数
 * @return 含总记录数和当前页数据的Page对象.
 */
@Transactional(readOnly = true)
public <T> Page pagedQuery(Class<T> entityClass, Page page) {
    Criteria criteria = createCriteria(entityClass);

    if (page.isOrderEnabled()) {
        for (int i = 0; i < page.getOrderBys().size(); i++) {
            String orderBy = page.getOrderBys().get(i);
            String order = page.getOrders().get(i);

            if ("ASC".equals(page.getOrders().get(i))) {
                criteria.addOrder(Order.asc(orderBy));
            } else {
                criteria.addOrder(Order.desc(orderBy));
            }
        }
    }

    Page resultPage = this.pagedQuery(criteria, page.getPageNo(),
            page.getPageSize());
    resultPage.setOrderBys(page.getOrderBys());
    resultPage.setOrders(page.getOrders());

    return resultPage;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:36,代码来源:HibernatePagingDao.java

示例3: search

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
public List<App> search(Short catalog, Integer subCatalog, int page, int rows, String keywords, String sort,
        String order) {
    Criteria cri = searchByFilter(catalog, subCatalog, keywords);
    if (subCatalog != null) {
        cri.add(Restrictions.eq("subCatalog", subCatalog));
    }
    // cri.addOrder(Order.asc("auditCatalog"));
    if (sort != null && !sort.isEmpty()) {
        HibernateHelper.addOrder(cri, sort, order);
    } else {
        if (order != null && "asc".equals(order)) {
            cri.addOrder(Order.asc("downloads"));
        } else {
            cri.addOrder(Order.desc("downloads"));
        }
    }
    if ("marketName".equals(sort)) {
        cri.addOrder(Order.desc("downloads"));
    }
    // cri.addOrder(Order.asc("name"));
    cri.setMaxResults(rows);
    cri.setFirstResult(HibernateHelper.firstResult(page, rows));
    List<App> list = HibernateHelper.list(cri);
    return list;
}
 
开发者ID:zhaoxi1988,项目名称:sjk,代码行数:27,代码来源:AppDaoImpl.java

示例4: handleFindZipCodes

import org.hibernate.criterion.Order; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
protected Collection<String> handleFindZipCodes(String countryName, String zipCodePrefix, String cityName, String streetName, Integer limit)
{
	org.hibernate.Criteria streetCriteria = createStreetCriteria();
	if (!CommonUtil.isEmptyString(countryName)) {
		streetCriteria.add(Restrictions.eq("countryName", countryName));
	}
	CategoryCriterion.apply(streetCriteria, new CategoryCriterion(zipCodePrefix, "zipCode", MatchMode.START));
	if (!CommonUtil.isEmptyString(cityName)) {
		streetCriteria.add(Restrictions.eq("cityName", cityName));
	}
	if (!CommonUtil.isEmptyString(streetName)) {
		streetCriteria.add(Restrictions.eq("streetName", streetName));
	}
	streetCriteria.add(Restrictions.not(Restrictions.or(Restrictions.eq("zipCode", ""), Restrictions.isNull("zipCode"))));
	streetCriteria.addOrder(Order.asc("zipCode"));
	streetCriteria.setProjection(Projections.distinct(Projections.property("zipCode")));
	CriteriaUtil.applyLimit(limit,
			Settings.getIntNullable(SettingCodes.ZIP_CODE_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT, Bundle.SETTINGS, DefaultSettings.ZIP_CODE_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT),
			streetCriteria);
	return streetCriteria.list();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:26,代码来源:StreetDaoImpl.java

示例5: search

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
public List<App> search(Short catalog, Integer subCatalog, int page, int rows, String keywords, Integer id,
        String sort, String order) {
    Criteria cri = searchByFilter(catalog, subCatalog, keywords, id);
    if (subCatalog != null) {
        cri.add(Restrictions.eq("subCatalog", subCatalog));
    }
    // cri.addOrder(Order.asc("auditCatalog"));
    if (sort != null && !sort.isEmpty()) {
        HibernateHelper.addOrder(cri, sort, order);
    } else {
        if (order != null && "asc".equals(order)) {
            cri.addOrder(Order.asc("downloadRank"));
        } else {
            cri.addOrder(Order.desc("downloadRank"));
        }
    }
    if ("marketName".equals(sort)) {
        cri.addOrder(Order.desc("downloadRank"));
    }
    // cri.addOrder(Order.asc("name"));
    cri.setMaxResults(rows);
    cri.setFirstResult(HibernateHelper.firstResult(page, rows));
    List<App> list = HibernateHelper.list(cri);
    return list;
}
 
开发者ID:zhaoxi1988,项目名称:sjk,代码行数:27,代码来源:AppDaoImpl.java

示例6: search

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
public List<ViewTagApps> search(Integer tagId, Integer catalog, Short tagType, int page, int rows, String keywords,
        String sort, String order) {
    Criteria cri = searchByFilter(tagId, catalog, tagType, keywords);
    if (sort != null && !sort.isEmpty()) {
        HibernateHelper.addOrder(cri, sort, order);
    } else {
        if (order != null && "asc".equals(order)) {
            cri.addOrder(Order.asc("id"));
        } else {
            cri.addOrder(Order.desc("id"));
        }
    }
    cri.setMaxResults(rows);
    cri.setFirstResult(HibernateHelper.firstResult(page, rows));
    List<ViewTagApps> list = HibernateHelper.list(cri);
    return list;
}
 
开发者ID:zhaoxi1988,项目名称:sjk,代码行数:19,代码来源:AppAndTagDaoImpl.java

示例7: getRecheckingBatch

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
@Transactional
@SuppressWarnings("unchecked")
public Collection<ReferencedURL> getRecheckingBatch(final long startId, final int batchSize)
{
	return (Collection<ReferencedURL>) getHibernateTemplate().execute(new HibernateCallback()
	{
		@Override
		public Object doInHibernate(Session session) throws HibernateException, SQLException
		{
			Criteria c = session.createCriteria(ReferencedURL.class);

			policy.addRequiresCheckingCriteria(c);

			c.add(Restrictions.ge("id", startId));
			c.addOrder(Order.asc("id"));
			c.setMaxResults(batchSize);
			return c.list();
		}
	});
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:URLCheckerDaoImpl.java

示例8: buildCriteria

import org.hibernate.criterion.Order; //导入依赖的package包/类
private void buildCriteria(Criteria criteria,boolean queryCount){
	if(!queryCount && firstResult>0){
		criteria.setFirstResult(firstResult);			
	}
	if(!queryCount && maxResults>0){
		criteria.setMaxResults(maxResults);			
	}
	if(processInstanceId>0){
		criteria.add(Restrictions.eq("processInstanceId", processInstanceId));
	}
	if(rootProcessInstanceId>0){
		criteria.add(Restrictions.eq("rootProcessInstanceId", rootProcessInstanceId));
	}
	if(StringUtils.isNotEmpty(key)){
		criteria.add(Restrictions.eq("key", key));
	}
	if(!queryCount){
		for(String ascProperty:ascOrders){
			criteria.addOrder(Order.asc(ascProperty));
		}
		for(String descProperty:descOrders){
			criteria.addOrder(Order.desc(descProperty));
		}
	}
}
 
开发者ID:youseries,项目名称:uflo,代码行数:26,代码来源:ProcessVariableQueryImpl.java

示例9: buildCriteria

import org.hibernate.criterion.Order; //导入依赖的package包/类
private void buildCriteria(Criteria criteria,boolean queryCount){
	if(!queryCount && firstResult>0){
		criteria.setFirstResult(firstResult);			
	}
	if(!queryCount && maxResults>0){
		criteria.setMaxResults(maxResults);			
	}
	if(historyProcessInstanceId>0){
		criteria.add(Restrictions.eq("historyProcessInstanceId",historyProcessInstanceId));
	}
	if(StringUtils.isNotEmpty(key)){
		criteria.add(Restrictions.eq("key", key));
	}
	
	if(!queryCount){
		for(String ascProperty:ascOrders){
			criteria.addOrder(Order.asc(ascProperty));
		}
		for(String descProperty:descOrders){
			criteria.addOrder(Order.desc(descProperty));
		}
	}
}
 
开发者ID:youseries,项目名称:uflo,代码行数:24,代码来源:HistoryProcessVariableQueryImpl.java

示例10: handleFindByListEntryEcrfFieldIndex

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
protected Collection<ECRFFieldValue> handleFindByListEntryEcrfFieldIndex(Long probandListEntryId, Long ecrfFieldId, Long index, boolean auditTrail, boolean sort, PSFVO psf)
		throws Exception {

	org.hibernate.Criteria ecrfFieldValueCriteria = createEcrfFieldValueCriteria("ecrfFieldValue0");
	ecrfFieldValueCriteria.add(Restrictions.eq("listEntry.id", probandListEntryId.longValue()));
	ecrfFieldValueCriteria.add(Restrictions.eq("ecrfField.id", ecrfFieldId.longValue()));
	if (index != null) {
		ecrfFieldValueCriteria.add(Restrictions.eq("index", index.longValue()));
	} else {
		ecrfFieldValueCriteria.add(Restrictions.isNull("index"));
	}
	if (!auditTrail) {
		// uncorrelated - fast:
		// value with max id only:
		applyEcrfFieldValueMaxIdSubCriteria(ecrfFieldValueCriteria, null, null, probandListEntryId, ecrfFieldId, index);
	}
	SubCriteriaMap criteriaMap = new SubCriteriaMap(ECRFFieldValue.class, ecrfFieldValueCriteria);
	CriteriaUtil.applyPSFVO(criteriaMap, psf);
	if (sort) { // after applyPSFVO
		ecrfFieldValueCriteria.addOrder(Order.asc("index"));
		ecrfFieldValueCriteria.addOrder(Order.desc("id"));
	}
	return ecrfFieldValueCriteria.list();

}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:27,代码来源:ECRFFieldValueDaoImpl.java

示例11: handleFindRecentStatus

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
protected ProbandListStatusEntry handleFindRecentStatus(
		Long trialId, Long probandId, Timestamp maxRealTimestamp)
				throws Exception {
	org.hibernate.Criteria statusEntryCriteria = createStatusEntryCriteria(null);
	if (maxRealTimestamp != null) {
		statusEntryCriteria.add(Restrictions.le("realTimestamp", maxRealTimestamp));
	}
	if (trialId != null || probandId != null) {
		Criteria listEntryCriteria = statusEntryCriteria.createCriteria("listEntry");
		if (trialId != null) {
			listEntryCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));
		}
		if (probandId != null) {
			listEntryCriteria.add(Restrictions.eq("proband.id", probandId.longValue()));
		}
	}
	statusEntryCriteria.addOrder(Order.desc("realTimestamp"));
	statusEntryCriteria.addOrder(Order.desc("id"));
	statusEntryCriteria.setMaxResults(1);
	return (ProbandListStatusEntry) statusEntryCriteria.uniqueResult();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:23,代码来源:ProbandListStatusEntryDaoImpl.java

示例12: applySortOrders

import org.hibernate.criterion.Order; //导入依赖的package包/类
private static void applySortOrders(org.hibernate.Criteria listEntryCriteria, org.hibernate.Criteria ecrfFieldCriteria, org.hibernate.Criteria ecrfFieldValueCriteria) {
	if (listEntryCriteria != null) {
		listEntryCriteria.addOrder(Order.asc("trial"));
		listEntryCriteria.addOrder(Order.asc("position"));
	}
	if (ecrfFieldCriteria != null) {
		ecrfFieldCriteria.addOrder(Order.asc("trial"));
		ecrfFieldCriteria.addOrder(Order.asc("ecrf"));
		ecrfFieldCriteria.addOrder(Order.asc("section"));
	}
	if (ecrfFieldValueCriteria != null) {
		ecrfFieldValueCriteria.addOrder(Order.asc("index"));
	}
	if (ecrfFieldCriteria != null) {
		ecrfFieldCriteria.addOrder(Order.asc("position"));
	}
	if (ecrfFieldValueCriteria != null) {
		ecrfFieldValueCriteria.addOrder(Order.asc("id"));
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:21,代码来源:ECRFFieldValueDaoImpl.java

示例13: handleFindByTrialExcelPayoffsSorted

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
protected Collection<TrialTagValue> handleFindByTrialExcelPayoffsSorted(Long trialId,
		Boolean payoffs, Boolean excel) throws Exception {
	org.hibernate.Criteria tagValueCriteria = createTagValueCriteria();
	tagValueCriteria.add(Restrictions.eq("trial.id", trialId.longValue()));

	Criteria tagCriteria = tagValueCriteria.createCriteria("tag", CriteriaSpecification.INNER_JOIN);
	if (excel != null) {
		tagCriteria.add(Restrictions.eq("excel", excel.booleanValue()));
	}
	if (payoffs != null) {
		tagCriteria.add(Restrictions.eq("payoffs", payoffs.booleanValue()));
	}

	tagCriteria.addOrder(Order.asc("nameL10nKey"));
	return tagValueCriteria.list();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:18,代码来源:TrialTagValueDaoImpl.java

示例14: handleFindAspSubstances

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
protected Collection<AspSubstance> handleFindAspSubstances(String nameInfix, Integer limit) throws Exception
{
	org.hibernate.Criteria aspSubstanceCriteria = createAspSubstanceCriteria(true);
	applyAspSubstanceNameCriterions(aspSubstanceCriteria, nameInfix);
	aspSubstanceCriteria.addOrder(Order.asc("name"));
	CriteriaUtil.applyLimit(limit,
			Settings.getIntNullable(SettingCodes.ASP_SUBSTANCE_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT, Bundle.SETTINGS,
					DefaultSettings.ASP_SUBSTANCE_AUTOCOMPLETE_DEFAULT_RESULT_LIMIT),
					aspSubstanceCriteria);
	if (MATCH_ASP_NAME || MATCH_ASP_REGISTRATION_NUMBER || MATCH_ATC_CODE_CODE) {
		// ProjectionList projectionList = Projections.projectionList().add(Projections.id());
		// projectionList.add(Projections.property("name"));
		// List aspSubstances = aspSubstanceCriteria.setProjection(Projections.distinct(projectionList)).list();
		// Iterator it = aspSubstances.iterator();
		// ArrayList result = new ArrayList(aspSubstances.size());
		// while (it.hasNext()) {
		// result.add(this.load((Long) ((Object[]) it.next())[0]));
		// }
		// return result;
		return CriteriaUtil.listDistinctRoot(aspSubstanceCriteria, this, "name");
	} else {
		return aspSubstanceCriteria.list();
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:26,代码来源:AspSubstanceDaoImpl.java

示例15: search

import org.hibernate.criterion.Order; //导入依赖的package包/类
@Override
public List<MarketApp> search(EnumMarket enumMarket, Short catalog, Integer subCatalog, int page, int rows,
        String keywords, String sort, String order) {
    Criteria cri = searchByFilter(enumMarket, catalog, subCatalog, keywords);

    if (sort != null && !sort.isEmpty()) {
        HibernateHelper.addOrder(cri, sort, order);
    } else {
        if (order != null && "asc".equals(order)) {
            cri.addOrder(Order.asc("id"));
        } else {
            cri.addOrder(Order.desc("id"));
        }
    }
    cri.setMaxResults(rows);
    cri.setFirstResult(HibernateHelper.firstResult(page, rows));
    List<MarketApp> list = HibernateHelper.list(cri);
    return list;
}
 
开发者ID:zhaoxi1988,项目名称:sjk,代码行数:20,代码来源:MarketAppDaoImpl.java


注:本文中的org.hibernate.criterion.Order类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。