session.evict与clear之间的区别 [英] Difference Between session.evict vs clear

查看:103
本文介绍了session.evict与clear之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hibernate中的session.clear和evict方法有什么区别,两者是从session中删除实例的detatched对象。我应该在hibernate中使用session.clear和session.evict。

what is difference between session.clear and evict methods in hibernate.Both are detatched objects that is instance removed from session.when should i use session.clear and session.evict in hibernate.

推荐答案

evict()从会话中清除单个对象。 clear()驱逐会话中的所有对象。调用clear()就像在与会话相关的每个对象上调用evict()。

evict() evicts a single object from the session. clear() evicts all the objects in the session. Calling clear() is like calling evict() on every object associated with the session.

这篇关于session.evict与clear之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆