扫码一下
查看教程更方便
spring boot 默认使用 hibernate 作为 orm 实现。 为了使用 eclipselink,我们首先需要从 pom.xml 中的 spring-data-jpa 依赖中排除 hibernate 依赖
org.springframework.boot
spring-boot-starter-data-jpa
org.hibernate
hibernate-entitymanager
org.hibernate
hibernate-core
现在在 pom.xml 中包含 eclipse-link 依赖项。
org.eclipse.persistence
org.eclipse.persistence.jpa
2.7.8
以下是完整的 pom.xml
pom.xml
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.5.5
com.spring
springbootorm
0.0.1-snapshot
spring boot orm
demo project for spring boot orm
11
org.springframework.boot
spring-boot-starter-data-jpa
org.hibernate
hibernate-entitymanager
org.hibernate
hibernate-core
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-devtools
runtime
true
org.eclipse.persistence
org.eclipse.persistence.jpa
2.7.8
mysql
mysql-connector-java
runtime
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin