EclipseLink不会创建表

时间:2014-04-09 13:47:13

标签: java spring eclipselink

我正在使用eclipseLink和Spring开发一个应用程序。现在我正在使用h2之类的数据库。我的麻烦是eclipseLink无法创建表。

这是我的配置。

的persistence.xml:

<persistence>

    <persistence-unit name="myUnit">

    //some classes definition

     <properties>

     <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
     <property name="javax.persistence.jdbc.url" value="jdbc:h2:file:C:\Users\user\Desktop\myFolder\test.db" />
     <property name="javax.persistence.jdbc.user" value="sa" />
     <property name="javax.persistence.jdbc.password" value="" />
     <property name="eclipselink.ddl-generation" value="create-tables" />
     <property name="eclipselink.composite-unit.member" value="true"/>
     <property name="eclipselink.target-database"      value="org.eclipse.persistence.platform.database.H2Platform"/>
     <property name="eclipselink.ddl-generation.output-mode" value="database" />
     <property name="eclipselink.create-ddl-jdbc-file-name" value="create.sql"/>

      </properties>

    </persistence-unit>



</persistence>

弹簧context.xml中

<beans>

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
        p:entityManagerFactory-ref="emf">
        <property name="persistenceUnitName" value="myUnit" />
    </bean>

    <bean id="eclipseLinkJpaVendorAdapter"
        class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
    </bean>


    <tx:annotation-driven />

    <bean id="emf"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
        p:jpaVendorAdapter-ref="eclipseLinkJpaVendorAdapter"
        p:persistenceUnitName="myUnit">
        <property name="jpaPropertyMap">
            <map>
                <entry key="eclipselink.cache.shared.default" value="false" />
                <entry key="eclipselink.weaving" value="false" />
            </map>
        </property>
        <property name="loadTimeWeaver">
            <bean
                class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
        </property>
    </bean>

</beans>

此外我发现文件create.sql为空!!!

我在哪里做错了?

0 个答案:

没有答案