[英]Hibernate, load schema from file
In Hibernate, I can use hbm2dll tool to import data files after hibernate generates the schema from my model. 在Hibernate中,hibernate从模型中生成架构后,可以使用hbm2dll工具导入数据文件。 This is fine, but I want to load the file with my database schema and make hibernate use that instead of generating one.
很好,但是我想用数据库模式加载文件,并使休眠模式使用它而不是生成一个。
Let's say I have some database configured in my hibernate config 假设我在休眠配置中配置了一些数据库
<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:."/>
Now before I run my test I want to load the db with some schema defined in my schema.sql file. 现在,在运行测试之前,我想使用在schema.sql文件中定义的某些架构加载数据库。 And I don't want to use Spring , I know there is support for it there.
而且我不想使用Spring ,我知道那里有它的支持。
I know I could use hibernate.hbm2ddl to generate schema when SessionFactory is created but I'd rather want to load my manually defined schema. 我知道在创建SessionFactory时可以使用hibernate.hbm2ddl生成架构,但是我想加载手动定义的架构。 Something like
<jdbc:embedded-database>
from spring-jdbc. 类似于spring-jdbc中的
<jdbc:embedded-database>
。
Is there any support for that in Hibernate? Hibernate是否对此提供任何支持?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.