當前位置: 首頁>>代碼示例>>Java>>正文


Java Projections.projectionList方法代碼示例

本文整理匯總了Java中org.hibernate.criterion.Projections.projectionList方法的典型用法代碼示例。如果您正苦於以下問題:Java Projections.projectionList方法的具體用法?Java Projections.projectionList怎麽用?Java Projections.projectionList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.criterion.Projections的用法示例。


在下文中一共展示了Projections.projectionList方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAppsOfDropMarket

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<App> getAppsOfDropMarket(Session session, String marketName, Integer currentPage, Integer pageSize) {
    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("pkname"));
    proList.add(Projections.property("signatureSha1"));
    Criteria cri = session.createCriteria(App.class);
    cri.setProjection(proList);
    cri.setMaxResults(pageSize);
    cri.setFirstResult(HibernateHelper.firstResult(currentPage, pageSize));
    List<Object[]> list = HibernateHelper.list(cri);
    List<App> apps = null;
    if (list != null) {
        apps = new ArrayList<App>(list.size());
        for (Object[] obj : list) {
            App e = new App();
            e.setPkname((String) obj[0]);
            e.setSignatureSha1((String) obj[1]);
            apps.add(e);
        }
        list.clear();
    }
    return apps;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:24,代碼來源:AppDaoImpl.java

示例2: listMarketRank

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<Market> listMarketRank() {
    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("marketName"));
    proList.add(Projections.property("rank"));
    Criteria cri = getSession().createCriteria(Market.class);
    cri.setProjection(proList);
    List<Object[]> list = HibernateHelper.list(cri);
    List<Market> markets = null;
    if (list != null && !list.isEmpty()) {
        markets = new ArrayList<Market>(list.size());
        for (Object[] obj : list) {
            Market m = new Market();
            m.setMarketName((String) obj[0]);
            m.setRank((Integer) obj[1]);
            markets.add(m);
        }
    }
    return markets;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:21,代碼來源:MarketDaoImpl.java

示例3: createEcrfFieldStatusEntryDetachedCriteriaMaxId

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
private static DetachedCriteria createEcrfFieldStatusEntryDetachedCriteriaMaxId(org.hibernate.Criteria ecrfFieldStatusEntryCriteria, org.hibernate.Criteria ecrfFieldCriteria,
		org.hibernate.Criteria probandListEntryCriteria,
		ECRFFieldStatusQueue queue, Long probandListEntryId, Long ecrfFieldId) {
	DetachedCriteria subQuery = createEcrfFieldStatusEntryDetachedCriteria(ecrfFieldStatusEntryCriteria, ecrfFieldCriteria, probandListEntryCriteria, probandListEntryId,
			ecrfFieldId);
	if (queue != null) {
		subQuery.add(Restrictions.eq("queue", queue));
		subQuery.setProjection(Projections.max("id"));
	} else {
		ProjectionList proj = Projections.projectionList();
		proj.add(Projections.sqlGroupProjection(
				"max({alias}.id) as maxId",
				"{alias}.queue",
				new String[] { "maxId" },
				new org.hibernate.type.Type[] { Hibernate.LONG }));
		subQuery.setProjection(proj);
	}

	return subQuery;
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:21,代碼來源:ECRFFieldStatusEntryDaoImpl.java

示例4: listForBase

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<App> listForBase(short catalog, Integer subCatalog, int currentPage, int pageSize) {
    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("id"));
    proList.add(Projections.property("name"));
    proList.add(Projections.property("subCatalog"));
    proList.add(Projections.property("auditCatalog"));

    Criteria cri = getSession().createCriteria(App.class);
    cri.setProjection(proList);
    cri.addOrder(Order.asc("auditCatalog"));
    cri.addOrder(Order.asc("name"));
    cri.add(Restrictions.eq("catalog", catalog));
    if (subCatalog != null) {
        cri.add(Restrictions.eq("subCatalog", subCatalog));
    }
    cri.setMaxResults(pageSize);
    cri.setFirstResult(HibernateHelper.firstResult(currentPage, pageSize));
    List<Object[]> list = HibernateHelper.list(cri);
    List<App> apps = null;
    if (list != null) {
        apps = new ArrayList<App>(list.size());
        for (Object[] obj : list) {
            App e = new App((Integer) obj[0], (String) obj[1]);
            e.setSubCatalog((Integer) obj[2]);
            e.setAuditCatalog((Boolean) obj[3]);
            apps.add(e);
        }
        list.clear();
    }
    return apps;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:33,代碼來源:AppDaoImpl.java

示例5: listForDownloads

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<App> listForDownloads(Session session, int currentPage, int pageSize) {
    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("id"));
    proList.add(Projections.property("pkname"));
    proList.add(Projections.property("marketName"));

    Criteria cri = session.createCriteria(App.class);
    cri.setProjection(proList);
    cri.setMaxResults(pageSize);
    cri.setFirstResult(HibernateHelper.firstResult(currentPage, pageSize));
    // 先全部更新.
    // cri.add(Restrictions.or(Restrictions.ltProperty("realDownload",
    // "lastDayDownload"),
    // Restrictions.ne("deltaDownload", 0)));
    List<Object[]> list = HibernateHelper.list(cri);
    List<App> apps = null;
    if (list != null) {
        apps = new ArrayList<App>(list.size());
        for (Object[] obj : list) {
            App e = new App();
            e.setId((Integer) obj[0]);
            e.setPkname((String) obj[1]);
            e.setMarketName((String) obj[2]);
            apps.add(e);
        }
        list.clear();
    }
    return apps;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:31,代碼來源:AppDaoImpl.java

示例6: getForQuickTipsIndex

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<App> getForQuickTipsIndex(Session session, Integer currentPage, Integer pageSize) {
    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("name"));
    proList.add(Projections.property("downloadRank"));
    proList.add(Projections.property("catalog"));
    proList.add(Projections.property("id"));
    Criteria cri = session.createCriteria(App.class);
    cri.setProjection(proList);
    cri.add(Restrictions.eq("hidden", false));
    cri.addOrder(Order.asc("downloadRank"));
    if (currentPage != null && pageSize != null) {
        cri.setFirstResult(HibernateHelper.firstResult(currentPage, pageSize));
        cri.setMaxResults(pageSize);
    }
    List<Object[]> list = HibernateHelper.list(cri);
    List<App> apps = null;
    if (list != null) {
        apps = new ArrayList<App>(list.size());
        for (Object[] obj : list) {
            App e = new App();
            e.setName((String) obj[0]);
            e.setDownloadRank((Integer) obj[1]);
            e.setCatalog((Short) obj[2]);
            e.setId((Integer) obj[3]);
            apps.add(e);
        }
        list.clear();
    }
    return apps;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:32,代碼來源:AppDaoImpl.java

示例7: getApps

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<App> getApps(int currentPage, int pageSize) {

    Session session = null;
    try {
        session = this.sessions.openSession();

        ProjectionList proList = Projections.projectionList();
        proList.add(Projections.property("id"));
        proList.add(Projections.property("name"));
        proList.add(Projections.property("catalog"));
        proList.add(Projections.property("subCatalog"));
        proList.add(Projections.property("keywords"));
        proList.add(Projections.property("description"));
        proList.add(Projections.property("downloadRank"));
        /* safe scan */
        proList.add(Projections.property("adPopupTypes"));
        proList.add(Projections.property("signatureSha1"));
        proList.add(Projections.property("officialSigSha1"));
        /* safe scan */
        proList.add(Projections.property("marketName"));
        Criteria cri = session.createCriteria(App.class);
        cri.setProjection(proList);
        cri.add(Restrictions.eq("hidden", false));
        cri.setFirstResult(HibernateHelper.firstResult(currentPage, pageSize));
        cri.setMaxResults(pageSize);
        List<Object[]> list = HibernateHelper.list(cri);
        List<App> apps = null;
        if (list != null && !list.isEmpty()) {
            apps = new ArrayList<App>(list.size());
            for (Object[] obj : list) {
                App a = new App();
                String tmp = null;
                a.setId((Integer) obj[0]);
                a.setName(((String) obj[1]).toLowerCase().trim());
                a.setCatalog((Short) obj[2]);
                a.setSubCatalog((Integer) obj[3]);
                if ((tmp = (String) obj[4]) == null) {
                    a.setKeywords("");
                } else {
                    a.setKeywords(tmp.toLowerCase().trim());
                }
                if ((tmp = (String) obj[4]) == null) {
                    a.setDescription("");
                } else {
                    a.setDescription(tmp.toLowerCase().trim());
                }
                a.setDownloadRank((Integer) obj[6]);
                /* safe scan */
                a.setAdPopupTypes((String) obj[7]);
                a.setSignatureSha1((String) obj[8]);
                a.setOfficialSigSha1((String) obj[9]);
                /* safe scan */
                a.setMarketName((String) obj[10]);
                apps.add(a);
            }
            list.clear();
        }
        return apps;
    } catch (Exception e) {
        logger.error("error:", e);
        return null;
    } finally {
        if (session != null && session.isOpen()) {
            session.clear();
            session.close();
        }
    }
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:70,代碼來源:AppDaoImpl.java

示例8: getForIndex

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<App> getForIndex(Session session, Short catalog, Integer subCatalog, Integer currentPage,
        Integer pageSize) {
    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("id"));
    proList.add(Projections.property("name"));
    proList.add(Projections.property("description"));
    proList.add(Projections.property("keywords"));
    proList.add(Projections.property("subCatalog"));
    proList.add(Projections.property("downloadRank"));
    proList.add(Projections.property("catalog"));

    proList.add(Projections.property("adPopupTypes"));
    proList.add(Projections.property("signatureSha1"));
    proList.add(Projections.property("officialSigSha1"));

    Criteria cri = session.createCriteria(App.class);
    cri.setProjection(proList);
    cri.add(Restrictions.eq("hidden", false));
    if (catalog != null) {
        cri.add(Restrictions.eq("catalog", catalog));
    }
    if (subCatalog != null) {
        cri.add(Restrictions.eq("subCatalog", subCatalog));
    }
    if (currentPage != null && pageSize != null) {
        cri.setFirstResult(HibernateHelper.firstResult(currentPage, pageSize));
        cri.setMaxResults(pageSize);
    }
    List<Object[]> list = HibernateHelper.list(cri);
    List<App> apps = null;
    if (list != null) {
        apps = new ArrayList<App>(list.size());
        for (Object[] obj : list) {
            App a = new App();
            a.setId((Integer) obj[0]);
            a.setName((String) obj[1]);
            a.setDescription((String) obj[2]);
            a.setKeywords((String) obj[3]);
            a.setSubCatalog((Integer) obj[4]);
            a.setDownloadRank((Integer) obj[5]);
            a.setCatalog((Short) obj[6]);
            a.setAdPopupTypes((String) obj[7]);
            a.setSignatureSha1((String) obj[8]);
            a.setOfficialSigSha1((String) obj[9]);
            apps.add(a);
        }
        list.clear();
    }
    return apps;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:52,代碼來源:AppDaoImpl.java

示例9: getScanTop

import org.hibernate.criterion.Projections; //導入方法依賴的package包/類
@Override
public List<App> getScanTop() {
    ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("id"));
    proList.add(Projections.property("catalog"));
    proList.add(Projections.property("pkname"));
    proList.add(Projections.property("name"));
    proList.add(Projections.property("downloadUrl"));
    proList.add(Projections.property("description"));
    proList.add(Projections.property("logoUrl"));
    proList.add(Projections.property("size"));
    proList.add(Projections.property("version"));
    proList.add(Projections.property("versionCode"));
    proList.add(Projections.property("pageUrl"));
    proList.add(Projections.property("updateInfo"));
    proList.add(Projections.property("pathStatus"));

    Criteria cri = getSession().createCriteria(App.class);
    cri.setProjection(proList);
    cri.add(Restrictions.eq("hidden", false));
    cri.setMaxResults(300);
    cri.addOrder(Order.desc("downloadRank"));
    List<Object[]> list = HibernateHelper.list(cri);
    List<App> apps = null;
    if (list != null) {
        apps = new ArrayList<App>(list.size());
        for (Object[] obj : list) {
            App e = new App();
            e.setId((Integer) obj[0]);
            e.setCatalog((Short) obj[1]);
            e.setPkname((String) obj[2]);
            e.setName((String) obj[3]);
            e.setDownloadUrl((String) obj[4]);
            e.setDescription((String) obj[5]);
            e.setLogoUrl((String) obj[6]);
            e.setSize((Integer) obj[7]);
            e.setVersion((String) obj[8]);
            e.setVersionCode((Long) obj[9]);
            e.setPageUrl((String) obj[10]);
            e.setUpdateInfo((String) obj[11]);
            e.setPathStatus((Byte) obj[12]);
            apps.add(e);
        }
        list.clear();
    }
    return apps;
}
 
開發者ID:zhaoxi1988,項目名稱:sjk,代碼行數:48,代碼來源:AppDaoImpl.java


注:本文中的org.hibernate.criterion.Projections.projectionList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。