Hibernate 4.3 SessionFactory

Configuration configuration = new Configuration().configure();

//以下这两句就是4.3的新用法
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());

StandardServiceRegistryImpl registry = (StandardServiceRegistryImpl) builder.build();

SessionFactory sessionFactory = configuration.buildSessionFactory(registry);

Session session = sessionFactory.openSession();

Transaction tx = session.beginTransaction();
上一篇:TFS 2015 生成不输出任何结果


下一篇:我的第一个python web开发框架(17)——产品管理