Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Websphere可以';找不到我的Hibernate托管实体管理器_Hibernate_Spring_Openjpa_Websphere 7 - Fatal编程技术网

Websphere可以';找不到我的Hibernate托管实体管理器

Websphere可以';找不到我的Hibernate托管实体管理器,hibernate,spring,openjpa,websphere-7,Hibernate,Spring,Openjpa,Websphere 7,我在WebSphere7上使用Hibernate3.4和Spring2.5.6 在启动时,我的应用程序似乎在Hibernate与OpenJPA之间存在问题: 10/02/12 10:41:50:448 GMT] 00000010 LocalEntityMa I org.springframework.orm.jpa.LocalEntityManagerFactoryBean createNativeEntityManagerFactory Building JPA EntityManagerFa

我在WebSphere7上使用Hibernate3.4和Spring2.5.6

在启动时,我的应用程序似乎在Hibernate与OpenJPA之间存在问题:

10/02/12 10:41:50:448 GMT] 00000010 LocalEntityMa I org.springframework.orm.jpa.LocalEntityManagerFactoryBean createNativeEntityManagerFactory Building JPA EntityManagerFactory for persistence unit 'mypu' [10/02/12 10:41:50:495 GMT] 00000010 SystemErr R WARNING: Found unrecognized persistence provider "org.hibernate.ejb.HibernatePersistence" in place of OpenJPA provider. This provider's properties will not be used. 10/02/12 10:41:50:448 GMT]00000010 LocalEntityMa I org.springframework.orm.jpa.LocalEntityManagerFactoryBean createNativeEntityManagerFactory为持久化单元“mypu”构建jpa EntityManagerFactory [10/02/12 10:41:50:495 GMT]00000010系统错误R警告:找到无法识别的持久性提供程序“org.hibernate.ejb.HibernatePersistence”代替OpenJPA提供程序。将不使用此提供程序的属性。 。。。然后是一个可爱的堆栈跟踪,原因是:

PersistenceProvider[org.apache.openjpa.persistence。PersistenceProviderImpl@6b676b67]未返回名为“mypu”的EntityManagerFactory

关于信息,我的持久性单元定义如下:

<?xml version="1.0" encoding="UTF-8"?>

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0">
    <persistence-unit name="mypu" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>jdbc/serviceTrackerDS</jta-data-source>
        <class>...my classes...</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <!-- Properties for Hibernate & Derby -->
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
            <property name="hibernate.default_schema" value="APP"/>
            <property name="hibernate.hbm2ddl.auto" value="create" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.use_sql_comments" value="true" />
        </properties>
    </persistence-unit>
</persistence>

org.hibernate.ejb.HibernatePersistence
jdbc/serviceTrackerDS
…我的课。。。
真的
我不知道如何进行。似乎在某些地方使用了错误的持久性提供程序,但我在persistence.xml中指定了正确的提供程序。我知道OpenJPA是WebSphere7中默认的持久性管理器,但我想在这里使用Hibernate


有什么建议吗?

看来我需要向我的
entityManagerFactory
添加一个
jpaVendorAdapter

<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="mypu" />
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
    </property>
</bean>

仍在测试中,但作为一个解决方案看起来不错