[英]javax.persistence not included in spring data jpa?
I just created a maven project with this dependency我刚刚创建了一个具有此依赖项的 maven 项目
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
but I realized that all these classes are not found:但我意识到所有这些类都没有找到:
import javax.persistence.*
so I have to change the dependency to所以我必须将依赖项更改为
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
which I find it weird because last update is from Aug 21, 2017
我觉得这很奇怪,因为最后一次更新是从Aug 21, 2017
开始
there is no spring dependency that includes javax.persistence????没有包含 javax.persistence 的 spring 依赖项????
Spring Data JPA itself isn't an implementation of the JPA specification. Spring 数据 JPA 本身并不是 JPA 规范的实现。 It is an abstraction built on top of JPA that requires a JPA implementation, typically Hibernate, to function.它是建立在 JPA 之上的抽象,需要 JPA 实现,通常是 Hibernate,到 ZC1C4145268E68397 The JPA implementation provides the javax.persistence
classes. JPA 实现提供了javax.persistence
类。
If you're using Spring Boot's Data JPA starter, it has dependencies on both Spring Data JPA and Hibernate. If you're using Spring Boot's Data JPA starter, it has dependencies on both Spring Data JPA and Hibernate. Hibernate then has a dependency on the javax.persistence
API which makes its classes available to your application's code. Hibernate 然后依赖于javax.persistence
API,这使得它的类可用于您的应用程序代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.