<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)

    隨筆檔案

    文章檔案

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲国产成人在线视频| 亚洲日本一区二区三区在线| 国产亚洲福利精品一区| 一二三区免费视频| 亚洲AV无码之日韩精品| 色吊丝性永久免费看码| 亚洲国产婷婷综合在线精品| 青草青草视频2免费观看| 国产小视频免费观看| 美国免费高清一级毛片| 免费大香伊蕉在人线国产| 国产亚洲精彩视频| 亚洲国产精品成人一区| 国产精品极品美女自在线观看免费 | 亚洲一区二区观看播放| 日韩视频免费在线| 免费的黄色网页在线免费观看| 区久久AAA片69亚洲| 亚欧日韩毛片在线看免费网站| 久久久国产精品亚洲一区| 免费阿v网站在线观看g| 亚洲色无码专区一区| 在线观看免费亚洲| eeuss免费影院| 亚洲精品在线观看视频| 男女免费观看在线爽爽爽视频| 亚洲精品av无码喷奶水糖心| 亚洲日韩在线观看| 91成人在线免费观看| 亚洲欧洲av综合色无码| 亚洲精品乱码久久久久久蜜桃| 麻豆精品不卡国产免费看| 亚洲妇女熟BBW| 亚洲人成网站观看在线播放| 无码专区AAAAAA免费视频| 亚洲va久久久久| 亚洲愉拍99热成人精品热久久 | 国产免费MV大全视频网站| 亚洲最大成人网色| 性做久久久久免费看| 日本一区午夜艳熟免费|