简体   繁体   English

休眠自定义DDL创建

[英]hibernate custom DDL creating

I have my custom sql file with DDL queries. 我有带有DDL查询的自定义sql文件。 I need to init my schemes with this file. 我需要使用该文件初始化我的计划。 Not by 不靠

 <property name="hibernate.hbm2ddl.auto">create</property>

How i can do that? 我该怎么做?

There is a special filename called import.sql which you can include in the root of your application's classpath which Hibernate will look for after creating the database schema, allowing users to contribute additional SQL commands that Hibernate should execute at bootstrap. 有一个名为import.sql的特殊文件名,您可以在应用程序的类路径的根目录中包含该文件名,Hibernate在创建数据库模式后将在该文件名中查找该文件名,从而允许用户提供其他Hibernate在引导时执行的SQL命令。

You can influence this special filename by adjusting the following property: 您可以通过调整以下属性来影响此特殊文件名:

// default setting
hibernate.hbm2ddl.import_files="/import.sql"

Should you need to import multiple files, you can specify them using this property setting using a comma-delimited pattern, eg /import1.sql,/import2.sql . 如果需要导入多个文件,则可以使用此属性设置使用逗号分隔的模式来指定它们,例如/import1.sql,/import2.sql

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM