2013年12月19日
摘要: 1. 配置了thread 后,才可使用sf.getCurrentSession(); 2.基本用法,getCurrentSession()不用Close()    openSession() 需要 Close() teacher s = new teacher(); s.setTitle("title"); s.setName("wzh"); Configuration cfg = new AnnotationConfiguration(); SessionFactory sf = cfg.configure().buildSessionFactory(); Session session = sf.openSession(); session.beginTransaction(); session.save(s); session.getTransaction().commit(); session.cl 阅读全文
posted @ 2013-12-19 22:03 上校 阅读(231) 评论(0) 推荐(0)