对于hibernate 5.X init函数需要这么写
对于hibernate 5.X init函数需要这么写
public void init() {
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure().build();
sessionFactory = new MetadataSources(serviceRegistry).buildMetadata().buildSessionFactory();
session = sessionFactory.openSession();
transaction = session.beginTransaction();
}