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

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

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

    Neil的備忘錄

    just do it
    posts - 66, comments - 8, trackbacks - 0, articles - 0

    Modifying persistent objects

    Posted on 2008-11-01 10:09 Neil's NoteBook 閱讀(80) 評論(0)  編輯  收藏

    Transactional persistent instances (ie. objects loaded, saved, created or queried by the Session) may be manipulated by the application and any changes to persistent state will be persisted when the Session is flushed (discussed later in this chapter). There is no need to call a particular method (like update(), which has a different purpose) to make your modifications persistent. So the most straightforward way to update the state of an object is to load() it, and then manipulate it directly, while the Session is open:

    DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );
    cat.setName("PK");
    sess.flush();  // changes to cat are automatically detected and persisted

    Sometimes this programming model is inefficient since it would require both an SQL SELECT (to load an object) and an SQL UPDATE (to persist its updated state) in the same session. Therefore Hibernate offers an alternate approach, using detached instances.

    Note that Hibernate does not offer its own API for direct execution of UPDATE or DELETE statements. Hibernate is a state management service, you don't have to think in statements to use it. JDBC is a perfect API for executing SQL statements, you can get a JDBC Connection at any time by calling session.connection(). Furthermore, the notion of mass operations conflicts with object/relational mapping for online transaction processing-oriented applications. Future versions of Hibernate may however provide special mass operation functions. See Chapter 13, Batch processing for some possible batch operation tricks.


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


    網站導航:
     
    主站蜘蛛池模板: 老司机午夜性生免费福利| 亚洲.国产.欧美一区二区三区| 一区二区无码免费视频网站| 亚洲国产综合无码一区| 三级毛片在线免费观看| 亚洲精品国产美女久久久| 免费在线观看一区| 亚洲午夜福利717| 嫩草在线视频www免费看| 亚洲国产精久久久久久久| 午夜无码A级毛片免费视频| 亚洲无成人网77777| 国产大片免费网站不卡美女| 国产精品亚洲精品观看不卡| 成年女人18级毛片毛片免费观看| 亚洲?V无码乱码国产精品| 九九久久国产精品免费热6| 无码国产亚洲日韩国精品视频一区二区三区 | 午夜神器成在线人成在线人免费| 免费又黄又爽的视频| 一级毛片视频免费观看| 亚洲熟妇无码八AV在线播放| 你懂得的在线观看免费视频| 亚洲人成在线播放网站岛国| 毛片免费视频在线观看| 日韩一区二区三区免费播放| 在线A亚洲老鸭窝天堂| 最近中文字幕免费2019| 亚洲精品无码专区在线| 久久精品国产精品亚洲| 亚洲免费在线视频播放| 老司机亚洲精品影院在线观看| 在线a级毛片免费视频| 久久精品熟女亚洲av麻豆| 亚洲日韩国产精品乱| 青青草无码免费一二三区| 亚洲AV综合永久无码精品天堂 | 午夜网站免费版在线观看| 国产精品hd免费观看| 久久综合亚洲色一区二区三区| 国产日韩AV免费无码一区二区 |