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

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

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

    Something you may ingore when to use Hibernate and JPA.

    The first is about identity generator, this is something I ingored and find really interesting later when I read back the document.

        When you choose "native" (for plain hibernate) or "AUTO" (for JPA which use hibernate as provider) as identity generator, it (actually they are the same identity generator but with different name in different scope) will pick other identity generators like identity, sequence, or hilo, depending on the capabilities of the underlying database. Use this generator to keep your mapping metadata portable to different database management systems.
        If your underlying DB is oracle, it will automatically create a sequence for you which means choose the sequence as identity generator, that's really interesting, at least for me for the first time when it comes to me.

    The second is about the flush and close session operations when to use hibernate with JTA transaction.

        You should manually flush your operation by call flush method and close your session by calling close method when you try to use JTA transaction instead of hibernate Transaction API, these is because hibernate Transaction API does thoes operations automatically for you. But, with following configuration, it can also be done automatically for you by hibernate, though you are still with JTA transaction.

        hibernate.transaction.flush_before_completion=true
        hibernate.transaction.auto_close_session=true

    The third is about an interesting code snatch listed as follow:
       
    1     Session session = sessionFactory.openSession();
    2     session.beginTransaction();
    3     session.save(new Item());
    4     session.close();

        What happen if you don't commit the transaction? It's depends on the underlying DB, for oracle it will commit any uncommited transactions, but for many other DB vendors, they will roll back any pending transactions.
       

    posted on 2008-04-03 16:32 Find it, try it, experience it 閱讀(917) 評論(0)  編輯  收藏


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


    網站導航:
     
    <2008年4月>
    303112345
    6789101112
    13141516171819
    20212223242526
    27282930123
    45678910

    導航

    統計

    公告

    If there is any question you have, please don't hesitate, let me know ASAP, you can find me at kenees@gmail.com or QQ: 9808873, hope to make friends with you ;)

    常用鏈接

    留言簿(1)

    隨筆檔案

    文章檔案

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 成人福利免费视频| 中文字幕在线免费播放| 日韩亚洲国产高清免费视频| 亚洲2022国产成人精品无码区 | 亚洲日本久久一区二区va| 久9久9精品免费观看| 亚洲高清免费在线观看| 又黄又爽又成人免费视频| 亚洲国产成a人v在线观看| 好吊妞视频免费视频| 男男gay做爽爽的视频免费| 内射无码专区久久亚洲| 国产特黄特色的大片观看免费视频| 亚洲日韩在线第一页| 91精品成人免费国产| 亚洲AV无码一区二区乱孑伦AS| 无码午夜成人1000部免费视频| 亚洲一区二区三区四区在线观看| 24小时免费看片| 久久亚洲国产成人影院| 免费一级国产生活片| 青青操免费在线视频| 久久亚洲AV成人无码软件| 国产卡一卡二卡三免费入口| 亚洲国产一区二区三区在线观看 | 亚洲色婷婷六月亚洲婷婷6月 | 一级特级女人18毛片免费视频 | 亚洲欧洲日产国码www| 女性无套免费网站在线看| 一个人看www免费高清字幕| 亚洲男人都懂得羞羞网站| 无码区日韩特区永久免费系列| 亚洲sm另类一区二区三区| 日本亚洲国产一区二区三区| 精品免费人成视频app| 国产亚洲精品欧洲在线观看| 亚洲精品无码久久一线| 久久精品网站免费观看| jizz免费一区二区三区| 亚洲五月丁香综合视频| 国产av无码专区亚洲av果冻传媒 |