标签:
Configuration cfg = new Configuration().configure();
SessionFactory sf = cfg.buildSessionFactory();
Session session = sf.openSession();
session.beginTransaction();
session.save();
session.getTransaction().commit();
session.close();
sf.close();
Configuration cfg = new Configuration().configure();
SessionFactory sf = cfg.buildSessionFactory();
Session session = sf.openSession();
session.beginTransaction();
session.update();
session.getTransaction().commit();
session.close();
sf.close();
Configuration cfg = new Configuration().configure();
SessionFactory sf = cfg.openSessionFactory();
Session session = sf.openSession();
session.beginTransaction();
session.delete();
session.getTransaction().commit();
session.close();
sf.close();
Configuration cfg = Configuration().configure();
SessionFactory sf = cfg.openSessionFactory();
Session session = sf.openSession();
session.findById();
session.close();
sf.close();
手打了4遍hibernate执行代码块呀,哈哈方法很Low,加深印象吧
标签:
原文地址:http://www.cnblogs.com/ddouble4j/p/5917563.html