@Test public void testHuanCun(){ Session session = sf.openSession(); session.beginTransaction(); Category c=(Category)session.load(Category.class,1); System.out.println(c.getName()); Category c2=(Category)session.load(Category.class,1); System.out.println(c2.getName()); session.getTransaction().commit(); session.close(); }测试结果:
@Test public void testHuanCun2(){ Session session = sf.openSession(); session.beginTransaction(); Category c=(Category)session.load(Category.class,1); System.out.println(c.getName()); session.getTransaction().commit(); session.close(); Session session2 = sf.openSession(); session2.beginTransaction(); Category c2=(Category)session2.load(Category.class,1); System.out.println(c2.getName()); session2.getTransaction().commit(); session2.close(); }测试结果:
二级缓存在下一个文档里:http://blog.csdn.net/acmman/article/details/44132207
转载请注明出处:http://blog.csdn.net/acmman/article/details/44132153