Hibernate clear method: empty cache
•
Java
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
二维码
