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