Hibernate 4.1.2.FINAL属性hbm2ddl.import_files似乎不起作用 [英] Hibernate 4.1.2.FINAL Properties hbm2ddl.import_files don't seems to work
问题描述
我有一个关于hbm2ddl.import_files的问题,似乎不起作用,而且似乎没有出现在日志中. 这是我的配置:
Hi I have a issue respect a hbm2ddl.import_files, it seems that don't work and not seems to appear in the log. this is my configuration:
<property name="hibernateProperties">
<value>
hibernate.dialect=${hibernate.dialect}
hibernate.default_schema=${hibernate.default_schema}
hibernate.jdbc.batch_size=${hibernate.jdbc.batch_size}
hibernate.show_sql=${hibernate.show_sql}
hibernate.hbm2ddl.auto=${hibernate.hbm2ddl.auto}
hibernate.id.new_generator_mappings=${hibernate.id.new_generator_mappings}
hibernate.hbm2ddl.import_files=${hibernate.hbm2ddl.import_files}
<!-- Auto Generated Schemas and tables not good for production
hibernate.hbm2ddl.auto=update-->
</value>
</property>
hibernate.hbm2ddl.import_files =/import.sql,文件为:
the hibernate.hbm2ddl.import_files=/import.sql, and the file is:
insert into DEPARTAMENTO (NOMBRE_DEPART,REFERENCIA_DEPART) values ('AMAZONAS')
jdbc.properties:
The jdbc.properties:
#org.hibernate.dialect.PostgreSQLDialect
hibernate.default_schema = "DBMERCANCIAS"
hibernate.show_sql = true
hibernate.id.new_generator_mappings = true
hibernate.hbm2ddl.auto = create
hibernate.jdbc.batch_size = 5
#Default the factory to use to instantiate transactions org.transaction.JDBCTransactionFactory
hibernate.transaction.factory_class=org.transaction.JDBCTransactionFactory
#Initialize values statements only on create-drop or create
hibernate.hbm2ddl.import_files = /import.sql
数据库是PostgreSQL 9.1.1,spring 3.1.0.RELEASE和hibernate 4.1.2.Final,将hibernate.hbm2ddl.auto设置为"create",表和模式创建但不运行sql命令插入为什么?,我可以在日志中看到此命令的运行位置.
The database is postgresql 9.1.1, spring 3.1.0.RELEASE and hibernate 4.1.2.Final, the hibernate.hbm2ddl.auto is set to "create", the tables and the schema create but not run sql command insert why?, I can see in the log where this command run.
推荐答案
我的错误是休眠属性中的位置.
My error was the location in hibernate properties.
hibernate.hbm2ddl.import_files = /META-INF/spring/import.sql
是正确的位置.
这篇关于Hibernate 4.1.2.FINAL属性hbm2ddl.import_files似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!