asklxf

          A java developer's notebook.

          常用鏈接

          統計

          積分與排名

          最新評論

          [導入]Hibernate 3.2 SQL函數返回類型從Integer變為Long

          如果你從Hibernate 3.0.x/3.1.x升級到最新的3.2版,一定要注意,3.2版的很多sql函數如count(), sum()的唯一返回值已經從Integer變為Long,如果不升級代碼,會得到一個ClassCastException。

          這個變化主要是為了兼容JPA,可以在hibernate.org的最新文檔中找到說明。

          Hibernate Team也提供了一個與原來兼容的解決方案:

            Configuration classicCfg = new Configuration();
            classicCfg.addSqlFunction( "count", new ClassicCountFunction());
            classicCfg.addSqlFunction( "avg", new ClassicAvgFunction());
            classicCfg.addSqlFunction( "sum", new ClassicSumFunction());
            SessionFactory classicSf = classicCfg.buildSessionFactory();


          文章來源:http://blog.csdn.net/asklxf/archive/2006/07/09/895855.aspx

          posted on 2006-07-09 17:07 Xuefeng's Weblog 閱讀(268) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 东平县| 彭山县| 县级市| 英德市| 平乐县| 安多县| 丹巴县| 铁岭县| 象山县| 石泉县| 丰镇市| 油尖旺区| 肥乡县| 鹰潭市| 莆田市| 全椒县| 霍林郭勒市| 望城县| 麻城市| 诏安县| 宕昌县| 贵州省| 吉水县| 中超| 新兴县| 广宗县| 封丘县| 买车| 金山区| 陇西县| 赣州市| 嵩明县| 曲阳县| 吉安县| 西昌市| 万盛区| 武功县| 阿荣旗| 明水县| 温州市| 上虞市|