<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    天空是藍色的

    做好軟件為中國 #gcc -c helloworld.c -o helloworld.o //編譯目標文件 #gcc helloworld.o -o helloworld //編譯成可執行exe #helloworld //運行exe
    數據加載中……
    俺用hibernate最原始的方法取得count(*)
    90934966D300E863F14BC5BA7B3ACB19.JPG

        public int getCount(String emailGroupId, String emailBatchId)
                
    throws HibernateException {

            Session session 
    = HibernateUtil.currentSession();
            Transaction tx 
    = session.beginTransaction();

            String hql 
    = "select count(*) from EmailSendInfo where email_group_id = :emailGroupId and batch_id = :batchId";
            Query query 
    = session.createQuery(hql);

            query.setString(
    "emailGroupId", emailGroupId);
            query.setString(
    "batchId", emailBatchId);

            
    for (Iterator it = query.iterate(); it.hasNext();) {
                
    return ((Integer) it.next()).intValue();
            }

            
    return 0;
        }
    俺覺得挺原始的,俺又不會用別的

    Spring+Hibernate 如何使用count(*)(轉) 
     
    第一種方法:
    String hql 
    = "select count(*) from User as user";
    Integer count = (Integer)getHibernateTemplate().find(hql).listIterator().next();
    return count.intValue();
    第二種方法:
    String hql 
    = "select count(*) from User as user";
    return ((Integer)getHibernateTemplate().iterate(hql).next()).intValue();
    第三種方法:
    String hql 
    = "select count(*) from User as user";
    Query query = getHibernateTemplate().createQuery( getSession(),hql);
    return ((Integer)query.uniqueResult()).intValue();  
     
    俺試了Spring 可是俺拿不到getHibernateTemplate 拿到總是空,可能是因為俺沒有配置applicationContext.xml中的<beans></beans>
    DAO support 需要注入一些東東吧,比如說sessionFactory... :(

    posted on 2005-12-22 12:27 bluesky 閱讀(3147) 評論(0)  編輯  收藏 所屬分類: 工作總結

    主站蜘蛛池模板: 亚洲色成人四虎在线观看| 亚洲人成网址在线观看| 亚洲大码熟女在线观看| 久久WWW免费人成人片| 亚洲偷偷自拍高清| 成人免费无毒在线观看网站| 亚洲偷自精品三十六区| 精品国产麻豆免费网站| 精品国产亚洲一区二区三区在线观看| 毛片免费在线观看网址| 亚洲а∨精品天堂在线| 亚洲精品动漫人成3d在线| 又长又大又粗又硬3p免费视频| 国产亚洲精品a在线观看 | 精品在线免费视频| 可以免费观看一级毛片黄a| 一级做a爰性色毛片免费| 亚洲人成色7777在线观看| 亚欧日韩毛片在线看免费网站| 亚洲图片中文字幕| 日韩高清在线免费观看| 日韩在线观看视频免费| 亚洲成年轻人电影网站www| 国产精品视频永久免费播放| 国产亚洲综合精品一区二区三区| 国产亚洲精品影视在线产品| 日韩免费无码视频一区二区三区| 亚洲成A人片在线播放器| 亚洲精品国产高清嫩草影院 | 91精品免费观看| 亚洲成av人片在www鸭子| 亚洲午夜精品第一区二区8050| 小日子的在线观看免费| 亚洲色成人四虎在线观看| 亚洲韩国精品无码一区二区三区| 久久不见久久见免费视频7| 亚洲av无码一区二区三区天堂| 亚洲综合无码精品一区二区三区| 中文字幕免费在线看线人| 国产成人人综合亚洲欧美丁香花 | 国产精品亚洲高清一区二区|