簡體   English   中英

WAS Liberty概要文件中的EclipseLink JPA

[英]EclipseLink JPA in WAS Liberty Profile

有人能夠通過容器管理事務在WAS Liberty Profile中使EclipseLink JPA povider工作嗎? 我已經使用JPA容器設置配置了server.xml文件,以覆蓋默認的OpenJPA實現,但是這會帶來副作用,即當通過具有事務傳播批注的EJB訪問時,EntityManager不再參與容器事務。

我還嘗試將“ eclipselink.target-server”屬性設置為“ WebSpeher_7”,但是當我這樣做時,我在com.ibm.ws.Transaction.TransactionManagerFactory類上得到了ClassNotFoundException。

下午好。 看起來您正在遇到Bug 407279( https://bugs.eclipse.org/bugs/show_bug.cgi?id=407279 )。

您可以通過以下更改來修改org.eclipse.persistence.transaction.was.WebSphereTransactionController來解決此問題:

public class WebSphereTransactionController extends JTATransactionController {
    // Class and method to execute to obtain the TransactionManager
    protected final static String TX_MANAGER_FACTORY_CLASS = "com.ibm.tx.jta.TransactionManagerFactory";
    // OLD VALUE --> "com.ibm.ws.Transaction.TransactionManagerFactory";

希望這可以幫助! 請確保抓住EclipseLink 2.5.2,因為它具有另一個重要的更改(錯誤412627),以便與Liberty一起使用!

我不得不使用自由16.0.0.2,Spring 4.X和EclipseLink 5.2.X來更改許多事情。

我刪除了persistence.xml文件,並將spring xml配置更改為:

<bean id="transactionManager"
    class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>


<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="datasource" />
    <property name="persistenceUnitName" value="PERSISTENCE_UNIT"></property>
    <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
    <property name="packagesToScan">
        <list>
            <value>ENTITIES_PACKAGE</value>
        </list>
    </property>
    <property name="jpaPropertyMap">
  <map>
    <entry key="eclipselink.weaving" value="false"/>
  </map>
</property>
    </bean>

對於server.xml

<jpa defaultPersistenceProvider="org.eclipse.persistence.jpa.PersistenceProvider"/>

<featureManager>
    <feature>servlet-3.0</feature>
    <feature>jdbc-4.0</feature>
    <feature>jpa-2.0</feature>
    <feature>localConnector-1.0</feature>
    <feature>jsp-2.2</feature>
</featureManager>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM