简体   繁体   English

根据条件选择多个Hibernate import.sql

[英]Choosing multiple Hibernate import.sql based on conditions

How can I specify which import file I want hibernate to run. 如何指定我想要运行hibernate的导入文件。 Is there any configuration option that I can put (I think I have seen something like this somewhere) that I can say custom .sql file and hibernate will run it. 有没有我可以放置的配置选项(我想我已经在某处看到了类似的东西)我可以说自定义.sql文件和hibernate将运行它。

I want to split my creation into multiple files. 我想将我的创作分成多个文件。 And also I want to run differnet scripts that will generate date based on my hibernate config that I am using. 而且我还想运行不同的脚本,这些脚本将根据我正在使用的hibernate配置生成日期。 So if I am using local it should one set of .sql files and if I am testing it into QA it should use another. 因此,如果我使用本地,它应该是一组.sql文件,如果我将它测试到QA,它应该使用另一个。

I have multiple config files that I can run depending on what I want, so now I need to figure out how to put which script should run in which configuration. 我有多个配置文件,我可以根据我的需要运行,所以现在我需要弄清楚如何在哪个配置中运行哪个脚本。

cheers 干杯

'hibernate.hbm2ddl.import_files' is the setting you want (org.hibernate.cfg.AvailableSettings#HBM2DDL_IMPORT_FILES). 'hibernate.hbm2ddl.import_files'是你想要的设置(org.hibernate.cfg.AvailableSettings#HBM2DDL_IMPORT_FILES)。

http://docs.jboss.org/hibernate/orm/4.1/javadocs/org/hibernate/cfg/AvailableSettings.html#HBM2DDL_IMPORT_FILES http://docs.jboss.org/hibernate/orm/4.1/javadocs/org/hibernate/cfg/AvailableSettings.html#HBM2DDL_IMPORT_FILES

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

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