摘要: 要创建session的时候,只要调用这个类里面的getSession()方法就可以了,import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.cfg.Configuration;public class HibernateUtils {private static SessionFactory factory;static { try { //读取配置文件 Configuration cfg = new Configuration().configure(); factory = 阅读全文