<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

    Working with objects

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

    Working With Objects

    Hibernate is a full object/relational mapping solution that not only shields the developer from the details of the underlying database management system, but also offers state management of objects. This is, contrary to the management of SQL statements in common JDBC/SQL persistence layers, a very natural object-oriented view of persistence in Java applications.

    In other words, Hibernate application developers should always think about the state of their objects, and not necessarily about the execution of SQL statements. This part is taken care of by Hibernate and is only relevant for the application developer when tuning the performance of the system.

    Hibernate object states

    Hibernate defines and supports the following object states:

    • Transient - an object is transient if it has just been instantiated using the new operator, and it is not associated with a Hibernate Session. It has no persistent representation in the database and no identifier value has been assigned. Transient instances will be destroyed by the garbage collector if the application doesn't hold a reference anymore. Use the Hibernate Session to make an object persistent (and let Hibernate take care of the SQL statements that need to be executed for this transition).

    • Persistent - a persistent instance has a representation in the database and an identifier value. It might just have been saved or loaded, however, it is by definition in the scope of a Session. Hibernate will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes. Developers don't execute manual UPDATE statements, or DELETE statements when an object should be made transient.

    • Detached - a detached instance is an object that has been persistent, but its Session has been closed. The reference to the object is still valid, of course, and the detached instance might even be modified in this state. A detached instance can be reattached to a new Session at a later point in time, making it (and all the modifications) persistent again. This feature enables a programming model for long running units of work that require user think-time. We call them application transactions, i.e. a unit of work from the point of view of the user.

    We'll now discuss the states and state transitions (and the Hibernate methods that trigger a transition) in more detail. 





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


    網站導航:
     
    主站蜘蛛池模板: 中国内地毛片免费高清| 亚洲精品国产精品| 七色永久性tv网站免费看| 亚洲精品久久久www| 曰韩无码AV片免费播放不卡| www亚洲一级视频com| 四虎一区二区成人免费影院网址| 亚洲男人av香蕉爽爽爽爽| 四虎永久在线精品免费一区二区| 免费**毛片在线播放直播 | 免费国产人做人视频在线观看| 亚洲AV无码一区二区三区牛牛| 日韩欧美一区二区三区免费观看| 亚洲第一男人天堂| 亚洲黄片毛片在线观看| 99麻豆久久久国产精品免费| 亚洲高清专区日韩精品| 114级毛片免费观看| 最新亚洲精品国偷自产在线 | 2048亚洲精品国产| 高清一区二区三区免费视频| 亚洲成人福利网站| 全免费一级毛片在线播放| 男女污污污超污视频免费在线看| 国产美女亚洲精品久久久综合| 亚洲一区二区在线免费观看| 亚洲av乱码一区二区三区| 国产18禁黄网站免费观看| 任你躁在线精品免费| 亚洲综合校园春色| 亚洲日韩在线中文字幕第一页| 久久午夜免费鲁丝片| 亚洲大码熟女在线观看| 亚洲综合AV在线在线播放| 久久精品一本到99热免费| 老子影院午夜伦不卡亚洲| 亚洲av一综合av一区| 韩国18福利视频免费观看| 国产免费无码一区二区| 亚洲人av高清无码| 国产亚洲一区二区精品|