Do I have to refresh entities after bulk updates / deletes with HQL?

旧城冷巷雨未停 提交于 2019-12-02 07:05:14

The answer is NO. As documented here:

13.3. DML-style operations

cite:

...As already discussed, automatic and transparent object/relational mapping is concerned with the management of object state. This implies that the object state is available in memory, hence manipulating (using the SQL Data Manipulation Language (DML) statements: INSERT, UPDATE, DELETE) data directly in the database will not affect in-memory state. However, NHibernate provides methods for bulk SQL-style DML statement execution which are performed through the Hibernate Query Language (HQL)...

DML is there for us, to skip the state management in memory...being more efficient from SQL statements point of view. But that means:

manipulating ... data directly in the database will not affect in-memory state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!