我遇到了奇怪的 java.lang.NoSuchFieldError: NONE 运行时错误,它试图将 JPA 与 Oracle DB 一起使用。我正在使用 Maven 构建。这是关键文件。我猜有些JAR有问题。
pox.xml
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.6-Final</version>
</dependency>
持久性.xml
<persistence-unit name="ifp-test" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.user" value="something"/>
<property name="javax.persistence.jdbc.password" value="something"/>
<property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin://@something_here"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</persistence-unit>
</persistence>
Java 代码
List arr_cust = entityManagerFactory.createEntityManager().createNativeQuery(sql_query).getResultList();
有人可以指出正确的方向吗?