0

I have read this question about schema data initialization for EclipseLink, and I want to achieve the same in Spring Data JPA.

The answers all assume the presence of a persistence.xml file, which I am not using.

Instead I have Spring config, as follows:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
    <property name="packagesToScan" value="rbf.staffing.data"/>
    <property name="jpaPropertyMap">
        <map>
            <entry key="eclipselink.weaving" value="false"/>
            <entry key="eclipselink.id-validation" value="NULL"/>
            <entry key="eclipselink.ddl-generation" value="create-tables" />
            <entry key="javax.persistence.sql-load-script-source" value="main/resources/import.sql" />
        </map>
    </property>
</bean>

Where jpaVendorAdapter is a EclipseLinkJpaVendorAdapter.

All the DDL works great, but the import.sql is not being executed. It is in src/main/resources

Community
  • 1
  • 1
NickJ
  • 9,380
  • 9
  • 51
  • 74
  • May be you can find the solution in [This link](http://stackoverflow.com/questions/16379605/how-to-work-with-javax-persistence-sql-load-script-source) – Daniel ORTIZ Feb 29 '16 at 21:28
  • that's the same question I linked to – NickJ Feb 29 '16 at 22:47
  • Set logging to finest and it should print out a message or an exception if the issue is because it cannot find the import.sql. Make sure the directory specified is relative to where the persistence unit it as defined from where the meta-inf/persistence.xml 'would' be located. I'm guessing you should just define "import.sql" depending on how it is packaged. – Chris Mar 01 '16 at 16:26

0 Answers0