Hibernate clear method: empty cache

clear()

Example

Session session = sessionFactory.openSession();  //定义Session
UserForm uf = new UserForm();  //定义持久化类对象
uf = (UserForm)session.get("com.model.UserForm",1);
System.out.println("执行clear方法前,uf是否在缓存中:"+session.contains(uf));
session.clear();
System.out.println("执行clear方法后,uf是否在缓存中:"+session.contains(uf));
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>