我正在创建SessionFactory,我将我的数据源作为对象在我正在创建SessionFactory的代码中,但是我无法将数据源设置为Hibernate Configuration对象.那么如何将我的数据源设置为SessionFactory?
Configuration configuration = new Configuration();
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect");
configuration.setProperties(properties);
configuration.setProperty("packagesToScan", "com.my.app");
SessionFactory sessionFactory = configuration.configure().buildSessionFactory();
Run Code Online (Sandbox Code Playgroud)