EclipseLinkJpaVendorAdapter instead of HibernateJpaVendorAdapter issue

后端 未结 1 1107
广开言路
广开言路 2020-12-12 19:31

using an application which consist of JSF, Spring and Hibernate. My example runs normally, then when i changed the class=\"org.springframework.orm.jpa.vendor.HibernateJpaVen

相关标签:
1条回答
  • 2020-12-12 20:23

    By default, EclipseLink expects run-time weaving to be enabled, otherwise you will receive an error in the form 'Cannot apply class transformer without LoadTimeWeaver specified'. This means that for cases using build-time weaving or no weaving at all, you will need to explicitly indicate this behavior. In order to disable EclipseLink weaving you will need to either configure an application's EntityManagerFactory Spring bean with:

    <property name="jpaPropertyMap">
      <map>
        <entry key="eclipselink.weaving" value="false"/>
      </map>
    </property>
    

    or add the

    <property name="eclipselink.weaving" value="false"/>
    

    to your application's persistence.xml file.

    I recommend to activate the weaving since it's a great improve in performance.

    To configure the default run-time weaver expected by EclipseLink, add the following:

    <property name="loadTimeWeaver">
      <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
    </property>
    

    to your application's EntityManagerFactory Spring bean.

    Then add this option to your JVM :

    -javaagent:/path-to-your-javaagent/org.springframework.instrument-3.1.1.RELEASE.jar
    

    In Spring 3.x the javaagent is localized in the org.springframework.instrument jar.

    You need the org.springframework.instrument library together with aspectjrt.jar and aspectjweaver.jar libraries.

    Reference

    • Optimizing JPA Performance
    0 讨论(0)
提交回复
热议问题