這是我的pom.xml:如何使用Hibernate實現JPA?
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.1-Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.10.Final</version>
</dependency>
當我有這兩個依賴關係,我可以成功運行我的Hello World示例。 (它使用的persistence.xml和映射到表中我的數據庫與@Entity標註類然而,當我改變我的休眠核到:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.1.Final</version>
</dependency>
我得到:
異常在線程 「主」 java.lang.IllegalAccessError:嘗試訪問方法org.hibernate.cfg.Configuration(Lorg /休眠/ cfg中/ SettingsFactory)從類org.hibernate.ejb.Ejb3Configuration
那麼如何V我可以使用hibernate core 4.2.1 final作爲JPA實現嗎?我想hibernate-entitymanager沒有第4版?