【发布时间】:2016-09-23 07:46:18
【问题描述】:
我的 Hibernate Config 不导入任何 .sql 文件。
这些文件位于src/test/resources,源位于src/test/java。
配置部分:
Configuration configuration = new Configuration();
configuration.addAnnotatedClass(SomeModel.class);
Properties p = new Properties();
p.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
p.put("hibernate.connection.driver_class", "org.h2.Driver");
p.put("hibernate.connection.url", "jdbc:h2:mem:test");
p.put("hibernate.show_sql", "true");
p.put("hibernate.hbm2ddl.auto", "create-drop");
p.put("hibernate.hbm2ddl.import_files", "/createdb.sql");
StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(p).build();
this.sf = configuration.buildSessionFactory(serviceRegistry);
我不知道他为什么不导入 .sql 文件。我希望任何人都可以帮助我。
问候
【问题讨论】:
-
是否假设使用不同的
.sql文件? -
@ScaryWombat 我使用了路径
p.put("hibernate.hbm2ddl.import_files", "/resources/facttable.sql");,但它也不起作用