Java Code Examples for org.hibernate.Query.setByte()

The following are Jave code examples for showing how to use setByte() of the org.hibernate.Query class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: sjk   File: MarketAppDaoImpl.java   View Source Code Vote up 5 votes
@Override
public List<MarketApp> search(EnumMarket enumMarket, Short catalog, Integer subCatalog, int page, int rows,
        String keywords, Integer id, Integer cputype, String sort, String order, Date startDate, Date endDate) {
    List<MarketApp> list = null;
    // cpu的类型为空的时候我们只需要到MarketApp中查找
    if (cputype == null)
        cputype = 0;
    if (cputype.byteValue() == 0) {
        list = findMarketAppList(enumMarket, catalog, subCatalog, page, rows, keywords, id, sort, order, startDate,
                endDate);
    } else { // cpu的类型为空的时候我们需要先到BigGamePack中查询一下然后再到MarketApp中查找
        list = new ArrayList<MarketApp>();
        List<MarketApp> marketList = findMarketAppList(enumMarket, catalog, subCatalog, page, rows, keywords, id,
                sort, order, startDate, endDate);
        String hql = "from BigGamePack where cputype =:cputype group by MarketAppId";
        Query query = getSession().createQuery(hql);
        query.setByte("cputype", cputype.byteValue());
        List<BigGamePack> bgList = HibernateHelper.list(query);
        if (null != bgList && bgList.size() > 0 && null != marketList && marketList.size() > 0) {
            for (BigGamePack bigGamePack : bgList) {
                for (MarketApp mp : marketList) {
                    if (mp.getId() == bigGamePack.getMarketAppId()) {
                        list.add(mp);
                    }
                }
            }
        }
    }
    return list;
}