<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 閱讀(918) 評論(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)

    隨筆檔案

    文章檔案

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 国产成人 亚洲欧洲| 亚洲精品第五页中文字幕| 美女无遮挡免费视频网站| 免费一级毛片正在播放| 中文无码亚洲精品字幕| 精品国产免费一区二区| 亚洲精品无码国产片| 国产成人免费全部网站| 国产天堂亚洲精品| 综合亚洲伊人午夜网 | 亚洲日韩一区精品射精| 国国内清清草原免费视频99| 亚洲乱码无限2021芒果| 成年性生交大片免费看| 亚洲AV无码一区二区三区牲色| 日本大片在线看黄a∨免费| 美女黄网站人色视频免费| 亚洲精品第一国产综合精品99| 国产激情久久久久影院老熟女免费| 亚洲精品视频在线看| 花蝴蝶免费视频在线观看高清版| 亚洲国产成人高清在线观看| 亚洲一区免费在线观看| 亚洲男人的天堂网站| 亚洲日本韩国在线| 久久ww精品w免费人成| 亚洲免费视频播放| 国产一级高清视频免费看| 国产在线观看无码免费视频| 亚洲成年人在线观看| 黄色成人网站免费无码av| 三级片免费观看久久| 亚洲av无码av制服另类专区| 日本成年免费网站| 四虎永久在线精品免费一区二区| 亚洲熟妇中文字幕五十中出| 午夜国产精品免费观看| 一道本在线免费视频| 亚洲区精品久久一区二区三区| 亚洲А∨精品天堂在线| 亚洲男同gay片|