【问题标题】:WebSphere 7 Entity Manager creation issue with Hibernate Provider?使用 Hibernate Provider 创建 WebSphere 7 Entity Manager 的问题?
【发布时间】:2016-03-20 22:57:03
【问题描述】:

我一直在 服务器无法为来自 org.hibernate.ejb.HibernatePersistence 提供程序的默认持久单元创建 EntityManagerFactory 工厂 当我尝试在 WebSphere 7 + Oracle 上运行 Web 应用程序(.war)时。到目前为止,这在 tomcat + MySql 下运行良好。 我的persistance.xml 的配置

<persistence-unit name="default">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <non-jta-data-source>src/test</non-jta-data-source>     
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.Oracle10gDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="validate"/>
            <property name="hibernate.connection.release_mode" value="after_transaction"/>            
    </persistence-unit>

在谷歌搜索后,有几种解决方案。但是即使在尝试了大约 2 天后也没有运气。 要解决此问题,我们是否需要在 WebSphere 中安装任何修订包? 请在下面的链接中找到堆栈跟踪文件。

https://www.ibm.com/developerworks/community/forums/html/topic?id=e54136aa-fbe0-4576-a41c-4b438475f0a5

【问题讨论】:

    标签: java hibernate websphere-7


    【解决方案1】:

    在 WebSphere v7 中要使用容器管理的 JPA,您需要安装 feature pack for JPA,它只支持 JPA 2.0。

    根据您的日志,您似乎使用的是 Hibernate 4.3,即 JPA 2.1。 您不能将它与经典的 WebSphere Application Server 一起使用,请参阅 Deploying application using Hibernate JPA 2.1 to IBM WebSphere 了解更多详细信息。

    因此,您要么需要降级到 Hibernate 4.2,使用应用程序管理的实体管理器,要么迁移到完全支持 JPA 2.1 的 WebSphere Liberty Profile 服务器 8.5.5.6 或更高版本。

    如果您的应用程序在 Tomcat 上运行,我建议您尝试 WebSphere Liberty,它也是轻量级、对开发人员友好的服务器,可免费下载 - https://developer.ibm.com/wasdev/

    【讨论】:

      猜你喜欢
      • 2011-02-16
      • 2015-06-27
      • 2017-05-14
      • 1970-01-01
      • 1970-01-01
      • 2015-04-19
      • 2011-04-03
      • 2022-10-25
      • 1970-01-01
      相关资源
      最近更新 更多