在Spring Data JPA中使用javax.persistence.sql-load-script-source

时间:2016-02-29 21:10:08

标签: java jpa eclipselink spring-data

我已阅读有关EclipseLink架构数据初始化的this question,我想在Spring Data JPA中实现相同的目标。

答案都假定存在persistence.xml文件,我没有使用。

相反,我有Spring配置,如下所示:

<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>

jpaVendorAdapterEclipseLinkJpaVendorAdapter

所有DDL都很好用,但import.sql没有被执行。它位于src/main/resources

0 个答案:

没有答案