[JAVA-13976] Fix integration tests after Spring Boot upgrade to 2.7.2 (#12647)
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
|
||||
spring:
|
||||
jersey:
|
||||
application-path: /odata
|
||||
|
||||
|
||||
jpa:
|
||||
defer-datasource-initialization: true
|
||||
show-sql: true
|
||||
open-in-view: false
|
||||
hibernate:
|
||||
ddl-auto: update
|
||||
properties:
|
||||
hibernate:
|
||||
globally_quoted_identifiers: true
|
||||
|
||||
sql:
|
||||
init:
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
insert into car_maker(id,name) values (1,'Special Motors');
|
||||
insert into car_maker(id,name) values (2,'BWM');
|
||||
insert into car_maker(id,name) values (3,'Dolores');
|
||||
insert into "car_maker"("id", "name") values (1,'Special Motors');
|
||||
insert into "car_maker"("id", "name") values (2,'BWM');
|
||||
insert into "car_maker"("id", "name") values (3,'Dolores');
|
||||
|
||||
insert into car_model(id,maker_fk,name,sku,year) values(1,1,'Muze','SM001',2018);
|
||||
insert into car_model(id,maker_fk,name,sku,year) values(2,1,'Empada','SM002',2008);
|
||||
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(1,1,'Muze','SM001',2018);
|
||||
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(2,1,'Empada','SM002',2008);
|
||||
|
||||
insert into car_model(id,maker_fk,name,sku,year) values(4,2,'BWM-100','BWM100',2008);
|
||||
insert into car_model(id,maker_fk,name,sku,year) values(5,2,'BWM-200','BWM200',2009);
|
||||
insert into car_model(id,maker_fk,name,sku,year) values(6,2,'BWM-300','BWM300',2008);
|
||||
|
||||
alter sequence hibernate_sequence restart with 100;
|
||||
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(4,2,'BWM-100','BWM100',2008);
|
||||
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(5,2,'BWM-200','BWM200',2009);
|
||||
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(6,2,'BWM-300','BWM300',2008);
|
||||
|
||||
@@ -159,7 +159,6 @@
|
||||
classname="com.gs.fw.common.mithra.generator.MithraGenerator" />
|
||||
<gen-reladomo
|
||||
xml="${project.basedir}/src/main/resources/reladomo/ReladomoClassList.xml"
|
||||
generateGscListMethod="true"
|
||||
generatedDir="${project.build.directory}/generated-sources/reladomo"
|
||||
nonGeneratedDir="${project.basedir}/src/main/java" />
|
||||
|
||||
@@ -268,7 +267,7 @@
|
||||
|
||||
<properties>
|
||||
<ebean.plugin.version>11.11.2</ebean.plugin.version>
|
||||
<reladomo.version>16.5.1</reladomo.version>
|
||||
<reladomo.version>18.1.0</reladomo.version>
|
||||
<build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
|
||||
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
|
||||
<ormlite.version>5.0</ormlite.version>
|
||||
|
||||
@@ -8,7 +8,7 @@ create table dept(
|
||||
loc varchar(13),
|
||||
constraint pk_dept primary key (deptno)
|
||||
);
|
||||
|
||||
|
||||
create table emp(
|
||||
empno numeric,
|
||||
ename varchar(10),
|
||||
@@ -26,25 +26,25 @@ insert into dept values(10, 'ACCOUNTING', 'NEW YORK');
|
||||
insert into dept values(20, 'RESEARCH', 'DALLAS');
|
||||
insert into dept values(30, 'SALES', 'CHICAGO');
|
||||
insert into dept values(40, 'OPERATIONS', 'BOSTON');
|
||||
|
||||
|
||||
insert into emp values(
|
||||
7839, 'KING', 'PRESIDENT', null,
|
||||
to_date('17-11-1981','dd-mm-yyyy'),
|
||||
parsedatetime('17-11-1981','dd-MM-yyyy'),
|
||||
7698, null, 10
|
||||
);
|
||||
insert into emp values(
|
||||
7698, 'BLAKE', 'MANAGER', 7839,
|
||||
to_date('1-5-1981','dd-mm-yyyy'),
|
||||
parsedatetime('01-05-1981','dd-MM-yyyy'),
|
||||
7782, null, 20
|
||||
);
|
||||
insert into emp values(
|
||||
7782, 'CLARK', 'MANAGER', 7839,
|
||||
to_date('9-6-1981','dd-mm-yyyy'),
|
||||
parsedatetime('09-06-1981','dd-MM-yyyy'),
|
||||
7566, null, 30
|
||||
);
|
||||
insert into emp values(
|
||||
7566, 'JONES', 'MANAGER', 7839,
|
||||
to_date('2-4-1981','dd-mm-yyyy'),
|
||||
parsedatetime('02-04-1981','dd-MM-yyyy'),
|
||||
7839, null, 40
|
||||
);
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
<dependency>
|
||||
<groupId>io.r2dbc</groupId>
|
||||
<artifactId>r2dbc-h2</artifactId>
|
||||
<version>${r2dbc-h2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -61,8 +60,4 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<r2dbc-h2.version>0.8.1.RELEASE</r2dbc-h2.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+1
@@ -11,4 +11,5 @@ logging.level.org.hibernate.SQL=INFO
|
||||
logging.level.org.hibernate.type=INFO
|
||||
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=false
|
||||
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
|
||||
spring.jpa.open-in-view=false
|
||||
+1
@@ -11,4 +11,5 @@ logging.level.org.hibernate.SQL=INFO
|
||||
logging.level.org.hibernate.type=INFO
|
||||
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
|
||||
spring.jpa.open-in-view=false
|
||||
+1
@@ -8,3 +8,4 @@ spring.h2.console.enabled=true
|
||||
spring.jpa.hibernate.ddl-auto=create-drop
|
||||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
||||
spring.h2.console.path=/h2-console
|
||||
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
|
||||
|
||||
+2
@@ -7,6 +7,8 @@ spring.jpa.hibernate.ddl-auto=create-drop
|
||||
spring.jpa.show-sql=false
|
||||
spring.jpa.properties.hibernate.format_sql=true
|
||||
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
|
||||
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
|
||||
|
||||
#spring.jpa.properties.hibernate.check_nullability=true
|
||||
spring.h2.console.enabled=true
|
||||
spring.h2.console.path=/h2-console
|
||||
|
||||
@@ -12,3 +12,6 @@ spring:
|
||||
driverClassName: org.h2.Driver
|
||||
jpa:
|
||||
spring.jpa.database-platform: org.hibernate.dialect.H2Dialect
|
||||
properties:
|
||||
hibernate:
|
||||
globally_quoted_identifiers: true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
INSERT INTO countries (id, name) VALUES (1, 'USA');
|
||||
INSERT INTO countries (id, name) VALUES (2, 'France');
|
||||
INSERT INTO countries (id, name) VALUES (3, 'Brazil');
|
||||
INSERT INTO countries (id, name) VALUES (4, 'Italy');
|
||||
INSERT INTO countries (id, name) VALUES (5, 'Canada');
|
||||
INSERT INTO "countries" VALUES (1, 'USA');
|
||||
INSERT INTO "countries" VALUES (2, 'France');
|
||||
INSERT INTO "countries" VALUES (3, 'Brazil');
|
||||
INSERT INTO "countries" VALUES (4, 'Italy');
|
||||
INSERT INTO "countries" VALUES (5, 'Canada');
|
||||
@@ -1,12 +1,12 @@
|
||||
insert into USER values (101, 'user1', 'comment1');
|
||||
insert into USER values (102, 'user2', 'comment2');
|
||||
insert into USER values (103, 'user3', 'comment3');
|
||||
insert into USER values (104, 'user4', 'comment4');
|
||||
insert into USER values (105, 'user5', 'comment5');
|
||||
insert into "user" values (101, 'user1', 'comment1');
|
||||
insert into "user" values (102, 'user2', 'comment2');
|
||||
insert into "user" values (103, 'user3', 'comment3');
|
||||
insert into "user" values (104, 'user4', 'comment4');
|
||||
insert into "user" values (105, 'user5', 'comment5');
|
||||
|
||||
insert into DOCUMENT values (1, 'doc1', 101);
|
||||
insert into DOCUMENT values (2, 'doc2', 101);
|
||||
insert into DOCUMENT values (3, 'doc3', 101);
|
||||
insert into DOCUMENT values (4, 'doc4', 101);
|
||||
insert into DOCUMENT values (5, 'doc5', 102);
|
||||
insert into DOCUMENT values (6, 'doc6', 102);
|
||||
insert into "document" values (1, 'doc1', 101);
|
||||
insert into "document" values (2, 'doc2', 101);
|
||||
insert into "document" values (3, 'doc3', 101);
|
||||
insert into "document" values (4, 'doc4', 101);
|
||||
insert into "document" values (5, 'doc5', 102);
|
||||
insert into "document" values (6, 'doc6', 102);
|
||||
@@ -32,13 +32,8 @@
|
||||
<dependency>
|
||||
<groupId>de.flapdoodle.embed</groupId>
|
||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
||||
<version>${embed.mongo.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<embed.mongo.version>3.2.6</embed.mongo.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+1
@@ -66,6 +66,7 @@ public class H2JpaConfig {
|
||||
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
|
||||
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
|
||||
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
|
||||
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
|
||||
|
||||
return hibernateProperties;
|
||||
}
|
||||
|
||||
+3
-1
@@ -8,4 +8,6 @@ spring.jpa.hibernate.ddl-auto = create
|
||||
spring.h2.console.enabled=true
|
||||
|
||||
# Uppercase Table Names
|
||||
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||
|
||||
hibernate.globally_quoted_identifiers=true
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class SpringBootProfileIntegrationTest {
|
||||
private GenericEntityRepository genericEntityRepository;
|
||||
|
||||
@Test
|
||||
public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() {
|
||||
public void givenGenericEntityRepository_whenSaveAndRetrieveEntity_thenOK() {
|
||||
GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test"));
|
||||
GenericEntity foundEntity = genericEntityRepository.findById(genericEntity.getId()).orElse(null);
|
||||
assertNotNull(foundEntity);
|
||||
|
||||
+1
@@ -62,6 +62,7 @@ public class H2TestProfileJPAConfig {
|
||||
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
|
||||
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
|
||||
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
|
||||
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
|
||||
|
||||
return hibernateProperties;
|
||||
}
|
||||
|
||||
+4
-2
@@ -17,8 +17,10 @@ import com.baeldung.boot.repository.EmployeeRepository;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
@SqlGroup({ @Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
|
||||
@Sql("/import_employees.sql")})
|
||||
@SqlGroup({
|
||||
@Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
|
||||
@Sql("/import_employees.sql")}
|
||||
)
|
||||
public class SpringBootSqlGroupAnnotationIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -19,6 +19,7 @@ hibernate.hbm2ddl.auto=create-drop
|
||||
hibernate.cache.use_second_level_cache=true
|
||||
hibernate.cache.use_query_cache=true
|
||||
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
|
||||
hibernate.globally_quoted_identifiers=true
|
||||
|
||||
spring.jpa.properties.hibernate.hbm2ddl.import_files=import_books.sql
|
||||
spring.sql.init.data-locations=import_*_users.sql
|
||||
@@ -1,3 +1,5 @@
|
||||
insert into EMPLOYEES values(1, 'Harsha', 'Developer');
|
||||
insert into EMPLOYEES values(2, 'John', 'Tester');
|
||||
insert into EMPLOYEES values(3, 'Ram', 'Manager');
|
||||
delete from "employees";
|
||||
|
||||
insert into "employees" values(1, 'Harsha', 'Developer');
|
||||
insert into "employees" values(2, 'John', 'Tester');
|
||||
insert into "employees" values(3, 'Ram', 'Manager');
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
insert into EMPLOYEES values(4, 'Eric', 'Senior Developer');
|
||||
insert into EMPLOYEES values(5, 'Vidhyaah', 'Senior Manager');
|
||||
insert into "employees" values(4, 'Eric', 'Senior Developer');
|
||||
insert into "employees" values(5, 'Vidhyaah', 'Senior Manager');
|
||||
@@ -1,5 +1,5 @@
|
||||
create table person (
|
||||
id integer identity primary key,
|
||||
id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
first_name varchar(30),
|
||||
last_name varchar(30)
|
||||
);
|
||||
+1
-1
@@ -13,6 +13,6 @@ public interface CompanyRepository extends JpaRepository<Company, Integer> {
|
||||
@Query("SELECT C FROM Company C WHERE C.contactPerson.firstName = ?1")
|
||||
List<Company> findByContactPersonFirstNameWithJPQL(String firstName);
|
||||
|
||||
@Query(value = "SELECT * FROM company WHERE contact_first_name = ?1", nativeQuery = true)
|
||||
@Query(value = "SELECT * FROM \"company\" WHERE \"contact_first_name\" = ?1", nativeQuery = true)
|
||||
List<Company> findByContactPersonFirstNameWithNativeQuery(String firstName);
|
||||
}
|
||||
|
||||
+2
@@ -4,3 +4,5 @@ spring.jpa.properties.hibernate.jdbc.batch_size=4
|
||||
spring.jpa.properties.hibernate.order_inserts=true
|
||||
spring.jpa.properties.hibernate.order_updates=true
|
||||
spring.jpa.properties.hibernate.generate_statistics=true
|
||||
|
||||
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
|
||||
+5
-5
@@ -21,7 +21,7 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
|
||||
|
||||
@Query("SELECT u FROM User u WHERE u.status = 1")
|
||||
Collection<User> findAllActiveUsers();
|
||||
|
||||
|
||||
@Query("select u from User u where u.email like '%@gmail.com'")
|
||||
List<User> findUsersWithGmailAddress();
|
||||
|
||||
@@ -75,14 +75,14 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
|
||||
@Query(value = "INSERT INTO Users (name, age, email, status, active) VALUES (:name, :age, :email, :status, :active)", nativeQuery = true)
|
||||
@Modifying
|
||||
void insertUser(@Param("name") String name, @Param("age") Integer age, @Param("email") String email, @Param("status") Integer status, @Param("active") boolean active);
|
||||
|
||||
|
||||
@Modifying
|
||||
@Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true)
|
||||
int updateUserSetStatusForNameNativePostgres(Integer status, String name);
|
||||
|
||||
|
||||
@Query(value = "SELECT u FROM User u WHERE u.name IN :names")
|
||||
List<User> findUserByNameList(@Param("names") Collection<String> names);
|
||||
|
||||
|
||||
void deleteAllByCreationDateAfter(LocalDate date);
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@@ -97,6 +97,6 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
|
||||
int deleteDeactivatedUsersWithNoModifyingAnnotation();
|
||||
|
||||
@Modifying(clearAutomatically = true, flushAutomatically = true)
|
||||
@Query(value = "alter table USERS add column deleted int(1) not null default 0", nativeQuery = true)
|
||||
@Query(value = "alter table USERS add column deleted int not null default 0", nativeQuery = true)
|
||||
void addDeletedColumn();
|
||||
}
|
||||
|
||||
+1
@@ -62,6 +62,7 @@ public class StudentJpaConfig {
|
||||
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
|
||||
hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache"));
|
||||
hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache"));
|
||||
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
|
||||
|
||||
return hibernateProperties;
|
||||
}
|
||||
|
||||
+3
-1
@@ -6,4 +6,6 @@ hibernate.show_sql=true
|
||||
hibernate.hbm2ddl.auto=create
|
||||
|
||||
hibernate.cache.use_second_level_cache=false
|
||||
hibernate.cache.use_query_cache=false
|
||||
hibernate.cache.use_query_cache=false
|
||||
|
||||
hibernate.globally_quoted_identifiers=true
|
||||
|
||||
+2
-2
@@ -64,7 +64,7 @@ public class PersistenceConfig {
|
||||
public AuditorAware<String> auditorProvider() {
|
||||
return new AuditorAwareImpl();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public LocalSessionFactoryBean sessionFactory() {
|
||||
final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
|
||||
@@ -175,7 +175,7 @@ public class PersistenceConfig {
|
||||
|
||||
hibernateProperties.setProperty("hibernate.show_sql", "true");
|
||||
// hibernateProperties.setProperty("hibernate.format_sql", "true");
|
||||
// hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
|
||||
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
|
||||
|
||||
// Envers properties
|
||||
hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix"));
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
|
||||
<property name="show_sql">true</property>
|
||||
<property name="hbm2ddl.auto">validate</property>
|
||||
|
||||
|
||||
<property name="hibernate.globally_quoted_identifiers">true</property>
|
||||
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.UserEager" />
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetailEager" />
|
||||
</session-factory>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user