8
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

我创建了一个 JPA 项目,我尝试在其中使用上述类,但我无法找到我缺少的 jar。请指导我。

4

5 回答 5

7

试试 Geronimo specs JPA2 jar http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/geronimo/specs/geronimo-jpa_2.0_spec/1.0-PFD2/ 还是没有官方的JPA2.jar

于 2010-02-11T08:41:39.917 回答
5

EclipseLink 提供了 JPA 2.0 参考实现,该实现自 Java EE 6 发布以来正式发布。您会在eclipselink-2.0.0.v20091127-r5931.zip中捆绑的 jar 中找到这些类。如果您正在寻找 Maven 存储库,请查看此页面

于 2010-02-11T22:37:56.147 回答
5

一个稍微好一点的答案(自 2011 年以来)是使用来自 maven Central 的答案,即

org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1-Final

或者

<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>

见:http ://repo1.maven.org/maven2/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/

对于所有可用版本,尤其是最新版本,请参阅http://repo1.maven.org/maven2/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/

于 2013-06-28T11:33:33.800 回答
3

这是hibernate-jpa-2.0

http://repository.jboss.org/maven2/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/

于 2011-01-18T09:45:27.307 回答
0

这些文件位于javax.persistence jar 文件中。javax.persistence jar 文件的 Eclipse 版本可以在Maven Central上找到。或者,您可以在项目pom.xml文件中添加以下依赖项,让 Maven 为您拉下它。

    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.1.1</version>
        <scope>compile</scope>
    </dependency>
于 2016-12-27T20:04:29.383 回答