title: Hibernate JPA not executing import.sql on classpath
body: <p>I have a Hibernate JPA project that has an <code>import.sql</code> file on the classpath.  I have tried a number of things to get it working.  My persistence.xml is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
      &lt;persistence-unit name="SNAPSHOTPU"
          transaction-type="JTA"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;jta-data-source&gt;java:jboss/datasources/PostgresqlDS&lt;/jta-data-source&gt;
          &lt;class&gt;net.example.Actor&lt;/class&gt;
          &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
          &lt;properties&gt;
              &lt;property name="hibernate.show_sql" value="true" /&gt;
              &lt;property name="javax.persistence.schema-generation.database.action"
                  value="drop-and-create" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="create-drop" /&gt;
              &lt;property name="hibernate.hbm2ddl.import_files" value="import.sql" /&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>I have also tried it without the <code>hibernate.hbm2ddl.*</code> stuff because this is JPA, but neither seems to work.  My import.sql is in <code>src/main/resources</code> and this is a Maven project.</p>
  
  <p>I have one valid SQL statement in the file:</p>
  
  <p><code>insert into actors values (1, 'Test Import.sql');</code></p>
  
  <p>I even tried a blank line at the beginning of the file as I saw someone suggest.  I have debug turned on for Hibernate and can see it running the DDL commands in the log to create the tables, but I do not see anything about <code>import.sql</code> or about the insert statement in the file.</p>
  
  <p>Why isn't this working?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>@Baldurian got it right below, here is what works (in the persistence.xml):</p>
  
  <pre><code>&lt;properties&gt;
      &lt;property name="hibernate.show_sql" value="true" /&gt;
      &lt;property name="javax.persistence.schema-generation.database.action"
          value="drop-and-create" /&gt;
      &lt;property name="javax.persistence.sql-load-script-source"
          value="/import.sql" /&gt;
  &lt;/properties&gt;
  </code></pre>