Steve Chambers Steve Chambers - 1 month ago 5
MySQL Question

Why isn't hbm2ddl.import_files working in hibernate4-maven-plugin (Hibernate 4.3.6)?

I have the following persistence.xml:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
<persistence-unit name="blah" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.hbm2ddl.import_files" value="myfile.sql"/>
</properties>
</persistence-unit>
</persistence>


But the
hibernate.hbm2ddl.import_files
property isn't working. Doesn't seem to matter where I put myfile.sql or prepend with a slash or even wildcards, classpath etc. (clutching at straws) - it never finds it and the log output doesn't indicate it is even looking for it. The default import.sql is used instead (and works).

Note: Have seen similar questions (e.g. this and this) but none of the resolutions worked for me.

Answer

I now think this problem is due to using the hibernate4-maven-plugin - it doesn't seem to support all the Hibernate properties.

Comments