Hibernate中的configuration.configure()是必需的吗?

时间:2019-01-23 13:30:31

标签: java hibernate persistence

我想知道在休眠状态下指令configuration.configure()是否是必需的?

那么,可以将其删除吗?是否可以说以下代码段是相似的: // snippet1      配置配置= new Configuration();      configuration.configure(); ///此行将在其他代码段中删除      SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder()。applySettings(configuration.getProperties())。build());

// snippet2:在此步骤中,删除了configure调用方法      配置配置= new Configuration();      SessionFactory sessionFactory = configuration.buildSessionFactory(new SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder()。applySettings(configuration.getProperties())。build());

0 个答案:

没有答案