Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.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
Hibernate EntityManager没有持久性提供程序-臭名昭著的错误_Hibernate_Jpa_Eclipselink - Fatal编程技术网

Hibernate EntityManager没有持久性提供程序-臭名昭著的错误

Hibernate EntityManager没有持久性提供程序-臭名昭著的错误,hibernate,jpa,eclipselink,Hibernate,Jpa,Eclipselink,过去几天我一直在努力解决这个错误。请有人指出我错在哪里 我正在尝试将JPA与eclipselink结合使用。它工作得很好。 为了检查JPA使用hibernate作为持久性提供程序的行为,我更改了persistence.xml,得到了一个臭名昭著的错误“使用hibernate命名的EntityManager没有持久性提供程序” My persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence versio

过去几天我一直在努力解决这个错误。请有人指出我错在哪里

我正在尝试将JPA与eclipselink结合使用。它工作得很好。 为了检查JPA使用hibernate作为持久性提供程序的行为,我更改了persistence.xml,得到了一个臭名昭著的错误“使用hibernate命名的EntityManager没有持久性提供程序”

My persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
  <persistence-unit name="usinghibernate">
    <provider>org.hibernate.ejb.HibernatePeristence</provider>
    <class>arun.ucerelay.datastructures.XVMUpdateProfile</class>
    <class>arun.ucerelay.datastructures.XVMUpdateProfileItem</class>

    <!-- Scan for annotated classes and Hibernate mapping XML files -->
    <properties>
       <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
       <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:krsna"/>
       <property name="hibernate.connection.username" value="scott"/>
       <property name="hibernate.connection.password" value="tiger"/>
       <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
       <property name="hibernate.show_sql" value="true"/>
    </properties>
  </persistence-unit>
</persistence>
以下是我为获得hibernate JAR所做的工作: 我在maven pom.xml中包含了2个依赖项:

 ...
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>3.5.6-Final</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.5.2</version>
    </dependency>
   ...
org.hibernate.ejb.HibernatePeristence

应该由

org.hibernate.ejb.HibernatePersistence
                              ^---

对的非常感谢你。
TRACE 2011-02-26 00:50:31,765 [main](PersistenceXmlLoader.java:112) org.hibernate.ejb.packaging.PersistenceXmlLoader - Validate with persistence_2_0.xsd schema on file file:/C:/arun/eclipse/workspace/practicewitheclipselink/target/classes/META-INF/persistence.xml
TRACE 2011-02-26 00:50:31,781 [main](PersistenceXmlLoader.java:117) org.hibernate.ejb.packaging.PersistenceXmlLoader - Found error with persistence_2_0.xsd schema on file file:/C:/arun/eclipse/workspace/practicewitheclipselink/target/classes/META-INF/persistence.xml
TRACE 2011-02-26 00:50:31,781 [main](PersistenceXmlLoader.java:127) org.hibernate.ejb.packaging.PersistenceXmlLoader - Validate with persistence_1_0.xsd schema on file file:/C:/arun/eclipse/workspace/practicewitheclipselink/target/classes/META-INF/persistence.xml
TRACE 2011-02-26 00:50:31,781 [main](PersistenceXmlLoader.java:239) org.hibernate.ejb.packaging.PersistenceXmlLoader - Persistent Unit name from persistence.xml: usinghibernate
TRACE 2011-02-26 00:50:31,781 [main](Ejb3Configuration.java:321) org.hibernate.ejb.Ejb3Configuration - PersistenceMetadata(version=1.0) [
   name: usinghibernate
   jtaDataSource: null
   nonJtaDataSource: null
   transactionType: RESOURCE_LOCAL
   provider: org.hibernate.ejb.HibernatePeristence
   useQuotedIdentifiers: false
   classes[
      arun.ucerelay.datastructures.XVMUpdateProfile      arun.ucerelay.datastructures.XVMUpdateProfileItem   ]
   packages[
   ]
   mappingFiles[
   ]
   jarFiles[
   ]
   hbmfiles: 0
   properties[
      hibernate.connection.username: scott
      hibernate.connection.password: tiger
      hibernate.dialect: org.hibernate.dialect.OracleDialect
      hibernate.show_sql: true
      hibernate.connection.url: jdbc:oracle:thin:@localhost:1521:krsna
      hibernate.connection.driver_class: oracle.jdbc.driver.OracleDriver
   ]]
Feb 26, 2011 12:50:31 AM UpdateProfileMain main
WARNING:  Arun Could not load profiles : No Persistence provider for EntityManager named usinghibernate
Feb 26, 2011 12:50:31 AM UpdateProfileMain main
WARNING:  Arun Could not load profiles : null
org.hibernate.ejb.HibernatePersistence
                              ^---