Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 休眠持续状态_Hibernate_Jpa_Persistent - Fatal编程技术网

Hibernate 休眠持续状态

Hibernate 休眠持续状态,hibernate,jpa,persistent,Hibernate,Jpa,Persistent,我在hibernate文档中读到了关于这种状态的令人困惑的句子。有人能解释一下它是怎么工作的吗 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. 假设我使用的是JPA,当我从数据库加载一个对象并对其进行更新,但不保存实体时,一段时间后应该仍然会更新。

我在hibernate文档中读到了关于这种状态的令人困惑的句子。有人能解释一下它是怎么工作的吗

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.

假设我使用的是JPA,当我从数据库加载一个对象并对其进行更新,但不保存实体时,一段时间后应该仍然会更新。我是对的

否。它应该在工作单元完成时更新,即在事务结束时。因此,我不需要手动调用update方法,对吗?;>是的,因为Hibernate将检测对处于持久状态的对象所做的任何更改,并将状态与数据库同步。