How does Hibernate detect dirty state of an entity object?

后端 未结 5 2038
一整个雨季
一整个雨季 2020-12-02 05:50

Is it using some kind of byte codes modification to the original classes?

Or, maybe Hibernate get the dirty state by compare the given object with previously persiste

5条回答
  •  一个人的身影
    2020-12-02 06:54

    It is simple-- when you load/get entity object by id and then set its new field values by setter method and close session without calling update() method. then hibernate automatically update the changed value in the table without affecting other fields. and at the same time entity object is in dirty state.

提交回复
热议问题