JAVA-25519 Upgrade spring-boot-persistence to Spring Boot 3 (#14895)
This commit is contained in:
parent
10be01ea64
commit
ff826f0d08
|
@ -9,9 +9,9 @@
|
|||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<artifactId>parent-boot-3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-3</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -49,10 +49,7 @@
|
|||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>${mysql-connector-java.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
|
@ -66,11 +63,17 @@
|
|||
<groupId>org.hsqldb</groupId>
|
||||
<artifactId>hsqldb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<mockito.version>2.23.0</mockito.version>
|
||||
<validation-api.version>2.0.1.Final</validation-api.version>
|
||||
<mysql-connector-java.version>8.0.31</mysql-connector-java.version>
|
||||
<start-class>com.baeldung.boot.Application</start-class>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -13,7 +13,7 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.boot.domain;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
/**
|
||||
* @author paullatzelsperger
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.baeldung.boot.domain;
|
||||
|
||||
import static javax.persistence.GenerationType.IDENTITY;
|
||||
import static jakarta.persistence.GenerationType.IDENTITY;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Country {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.baeldung.boot.domain;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
/**
|
||||
* @author harshavs
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.baeldung.boot.domain;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class GenericEntity {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.baeldung.boot.domain;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.baeldung.boot.naming.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.boot.naming.entity;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class Preference {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.baeldung.dataloading.model;
|
||||
|
||||
import static javax.persistence.GenerationType.IDENTITY;
|
||||
import static jakarta.persistence.GenerationType.IDENTITY;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Country {
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.baeldung.springbootcrudapp.application.controllers;
|
|||
|
||||
import com.baeldung.springbootcrudapp.application.repositories.UserRepository;
|
||||
import com.baeldung.springbootcrudapp.application.entities.User;
|
||||
import javax.validation.Valid;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.baeldung.springbootcrudapp.application.entities;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@Entity
|
||||
public class User {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.baeldung.springbootdatasourceconfig.application.entities;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.springboothibernate.application.models;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Book {
|
||||
|
|
|
@ -35,13 +35,13 @@ public class LegacyJpaImplNamingIntegrationTest extends NamingConfig {
|
|||
|
||||
String tableNameCreated = table.getName();
|
||||
boolean columnNameIsQuoted = table
|
||||
.getColumn(3)
|
||||
.getColumn(2)
|
||||
.isQuoted();
|
||||
String physicalNameCreated = table
|
||||
.getColumn(3)
|
||||
.getColumn(2)
|
||||
.getName();
|
||||
String implicitNameCreated = table
|
||||
.getColumn(2)
|
||||
.getColumn(3)
|
||||
.getName();
|
||||
|
||||
SoftAssertions.assertSoftly(softly -> {
|
||||
|
|
|
@ -16,10 +16,6 @@ import com.baeldung.boot.naming.entity.Account;
|
|||
|
||||
@RunWith(SpringRunner.class)
|
||||
@DataJpaTest
|
||||
@TestPropertySource(properties = {
|
||||
"spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy",
|
||||
"spring.jpa.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
|
||||
})
|
||||
@Import(Config.class)
|
||||
public class SpringBootDefaultNamingIntegrationTest extends NamingConfig {
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.baeldung.boot.naming;
|
||||
|
||||
import com.baeldung.boot.naming.MetadataExtractorIntegrator;
|
||||
import com.baeldung.boot.naming.NamingConfig.Config;
|
||||
import com.baeldung.boot.naming.entity.Preference;
|
||||
|
||||
|
@ -47,7 +46,7 @@ public class StrategyLegacyHbmImplIntegrationTest extends NamingConfig {
|
|||
String implicitNameExpected = "account";
|
||||
|
||||
String implicitNameCreated = preferenceTable
|
||||
.getColumn(3)
|
||||
.getColumn(1)
|
||||
.getName();
|
||||
String tableNameCreated = accountPreferencesTable.getName();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
|||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
||||
|
|
Loading…
Reference in New Issue