Skip to content

Commit 7f6b12a

Browse files
authored
[JAVA-13976] Fix integration tests after Spring Boot upgrade to 2.7.2 (#12647)
1 parent e151d4d commit 7f6b12a

File tree

49 files changed

+150
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+150
-118
lines changed

apache-olingo/src/main/resources/application.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
server:
22
port: 8080
3-
3+
44
spring:
55
jersey:
66
application-path: /odata
7-
7+
88
jpa:
99
defer-datasource-initialization: true
1010
show-sql: true
1111
open-in-view: false
1212
hibernate:
1313
ddl-auto: update
14+
properties:
15+
hibernate:
16+
globally_quoted_identifiers: true
1417

1518
sql:
1619
init:
+8-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
insert into car_maker(id,name) values (1,'Special Motors');
2-
insert into car_maker(id,name) values (2,'BWM');
3-
insert into car_maker(id,name) values (3,'Dolores');
1+
insert into "car_maker"("id", "name") values (1,'Special Motors');
2+
insert into "car_maker"("id", "name") values (2,'BWM');
3+
insert into "car_maker"("id", "name") values (3,'Dolores');
44

5-
insert into car_model(id,maker_fk,name,sku,year) values(1,1,'Muze','SM001',2018);
6-
insert into car_model(id,maker_fk,name,sku,year) values(2,1,'Empada','SM002',2008);
5+
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(1,1,'Muze','SM001',2018);
6+
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(2,1,'Empada','SM002',2008);
77

8-
insert into car_model(id,maker_fk,name,sku,year) values(4,2,'BWM-100','BWM100',2008);
9-
insert into car_model(id,maker_fk,name,sku,year) values(5,2,'BWM-200','BWM200',2009);
10-
insert into car_model(id,maker_fk,name,sku,year) values(6,2,'BWM-300','BWM300',2008);
11-
12-
alter sequence hibernate_sequence restart with 100;
8+
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(4,2,'BWM-100','BWM100',2008);
9+
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(5,2,'BWM-200','BWM200',2009);
10+
insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(6,2,'BWM-300','BWM300',2008);

libraries-data-db/pom.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@
159159
classname="com.gs.fw.common.mithra.generator.MithraGenerator" />
160160
<gen-reladomo
161161
xml="${project.basedir}/src/main/resources/reladomo/ReladomoClassList.xml"
162-
generateGscListMethod="true"
163162
generatedDir="${project.build.directory}/generated-sources/reladomo"
164163
nonGeneratedDir="${project.basedir}/src/main/java" />
165164

@@ -268,7 +267,7 @@
268267

269268
<properties>
270269
<ebean.plugin.version>11.11.2</ebean.plugin.version>
271-
<reladomo.version>16.5.1</reladomo.version>
270+
<reladomo.version>18.1.0</reladomo.version>
272271
<build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
273272
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
274273
<ormlite.version>5.0</ormlite.version>

libraries-data-db/src/main/resources/db.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ create table dept(
88
loc varchar(13),
99
constraint pk_dept primary key (deptno)
1010
);
11-
11+
1212
create table emp(
1313
empno numeric,
1414
ename varchar(10),
@@ -26,25 +26,25 @@ insert into dept values(10, 'ACCOUNTING', 'NEW YORK');
2626
insert into dept values(20, 'RESEARCH', 'DALLAS');
2727
insert into dept values(30, 'SALES', 'CHICAGO');
2828
insert into dept values(40, 'OPERATIONS', 'BOSTON');
29-
29+
3030
insert into emp values(
3131
7839, 'KING', 'PRESIDENT', null,
32-
to_date('17-11-1981','dd-mm-yyyy'),
32+
parsedatetime('17-11-1981','dd-MM-yyyy'),
3333
7698, null, 10
3434
);
3535
insert into emp values(
3636
7698, 'BLAKE', 'MANAGER', 7839,
37-
to_date('1-5-1981','dd-mm-yyyy'),
37+
parsedatetime('01-05-1981','dd-MM-yyyy'),
3838
7782, null, 20
3939
);
4040
insert into emp values(
4141
7782, 'CLARK', 'MANAGER', 7839,
42-
to_date('9-6-1981','dd-mm-yyyy'),
42+
parsedatetime('09-06-1981','dd-MM-yyyy'),
4343
7566, null, 30
4444
);
4545
insert into emp values(
4646
7566, 'JONES', 'MANAGER', 7839,
47-
to_date('2-4-1981','dd-mm-yyyy'),
47+
parsedatetime('02-04-1981','dd-MM-yyyy'),
4848
7839, null, 40
4949
);
5050

persistence-modules/r2dbc/pom.xml

-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
<dependency>
4040
<groupId>io.r2dbc</groupId>
4141
<artifactId>r2dbc-h2</artifactId>
42-
<version>${r2dbc-h2.version}</version>
4342
</dependency>
4443
<dependency>
4544
<groupId>org.springframework.boot</groupId>
@@ -61,8 +60,4 @@
6160
</plugins>
6261
</build>
6362

64-
<properties>
65-
<r2dbc-h2.version>0.8.1.RELEASE</r2dbc-h2.version>
66-
</properties>
67-
6863
</project>

persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ logging.level.org.hibernate.SQL=INFO
1111
logging.level.org.hibernate.type=INFO
1212
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
1313
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=false
14+
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
1415
spring.jpa.open-in-view=false

persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ logging.level.org.hibernate.SQL=INFO
1111
logging.level.org.hibernate.type=INFO
1212
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
1313
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
14+
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
1415
spring.jpa.open-in-view=false

persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ spring.h2.console.enabled=true
88
spring.jpa.hibernate.ddl-auto=create-drop
99
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
1010
spring.h2.console.path=/h2-console
11+
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ spring.jpa.hibernate.ddl-auto=create-drop
77
spring.jpa.show-sql=false
88
spring.jpa.properties.hibernate.format_sql=true
99
spring.jpa.properties.hibernate.validator.apply_to_ddl=false
10+
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
11+
1012
#spring.jpa.properties.hibernate.check_nullability=true
1113
spring.h2.console.enabled=true
1214
spring.h2.console.path=/h2-console

persistence-modules/spring-boot-persistence-h2/src/main/resources/application.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ spring:
1212
driverClassName: org.h2.Driver
1313
jpa:
1414
spring.jpa.database-platform: org.hibernate.dialect.H2Dialect
15+
properties:
16+
hibernate:
17+
globally_quoted_identifiers: true
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
INSERT INTO countries (id, name) VALUES (1, 'USA');
2-
INSERT INTO countries (id, name) VALUES (2, 'France');
3-
INSERT INTO countries (id, name) VALUES (3, 'Brazil');
4-
INSERT INTO countries (id, name) VALUES (4, 'Italy');
5-
INSERT INTO countries (id, name) VALUES (5, 'Canada');
1+
INSERT INTO "countries" VALUES (1, 'USA');
2+
INSERT INTO "countries" VALUES (2, 'France');
3+
INSERT INTO "countries" VALUES (3, 'Brazil');
4+
INSERT INTO "countries" VALUES (4, 'Italy');
5+
INSERT INTO "countries" VALUES (5, 'Canada');
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
insert into USER values (101, 'user1', 'comment1');
2-
insert into USER values (102, 'user2', 'comment2');
3-
insert into USER values (103, 'user3', 'comment3');
4-
insert into USER values (104, 'user4', 'comment4');
5-
insert into USER values (105, 'user5', 'comment5');
1+
insert into "user" values (101, 'user1', 'comment1');
2+
insert into "user" values (102, 'user2', 'comment2');
3+
insert into "user" values (103, 'user3', 'comment3');
4+
insert into "user" values (104, 'user4', 'comment4');
5+
insert into "user" values (105, 'user5', 'comment5');
66

7-
insert into DOCUMENT values (1, 'doc1', 101);
8-
insert into DOCUMENT values (2, 'doc2', 101);
9-
insert into DOCUMENT values (3, 'doc3', 101);
10-
insert into DOCUMENT values (4, 'doc4', 101);
11-
insert into DOCUMENT values (5, 'doc5', 102);
12-
insert into DOCUMENT values (6, 'doc6', 102);
7+
insert into "document" values (1, 'doc1', 101);
8+
insert into "document" values (2, 'doc2', 101);
9+
insert into "document" values (3, 'doc3', 101);
10+
insert into "document" values (4, 'doc4', 101);
11+
insert into "document" values (5, 'doc5', 102);
12+
insert into "document" values (6, 'doc6', 102);

persistence-modules/spring-boot-persistence-mongodb/pom.xml

-5
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,8 @@
3232
<dependency>
3333
<groupId>de.flapdoodle.embed</groupId>
3434
<artifactId>de.flapdoodle.embed.mongo</artifactId>
35-
<version>${embed.mongo.version}</version>
3635
<scope>test</scope>
3736
</dependency>
3837
</dependencies>
3938

40-
<properties>
41-
<embed.mongo.version>3.2.6</embed.mongo.version>
42-
</properties>
43-
4439
</project>

persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ final Properties additionalProperties() {
6666
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
6767
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
6868
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
69+
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
6970

7071
return hibernateProperties;
7172
}

persistence-modules/spring-boot-persistence/src/main/resources/application.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ spring.jpa.hibernate.ddl-auto = create
88
spring.h2.console.enabled=true
99

1010
# Uppercase Table Names
11-
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
11+
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
12+
13+
hibernate.globally_quoted_identifiers=true

persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class SpringBootProfileIntegrationTest {
2222
private GenericEntityRepository genericEntityRepository;
2323

2424
@Test
25-
public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() {
25+
public void givenGenericEntityRepository_whenSaveAndRetrieveEntity_thenOK() {
2626
GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test"));
2727
GenericEntity foundEntity = genericEntityRepository.findById(genericEntity.getId()).orElse(null);
2828
assertNotNull(foundEntity);

persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/config/H2TestProfileJPAConfig.java

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ final Properties additionalProperties() {
6262
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
6363
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
6464
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
65+
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
6566

6667
return hibernateProperties;
6768
}

persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationIntegrationTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717

1818
@RunWith(SpringRunner.class)
1919
@SpringBootTest(classes = Application.class)
20-
@SqlGroup({ @Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
21-
@Sql("/import_employees.sql")})
20+
@SqlGroup({
21+
@Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
22+
@Sql("/import_employees.sql")}
23+
)
2224
public class SpringBootSqlGroupAnnotationIntegrationTest {
2325

2426
@Autowired

persistence-modules/spring-boot-persistence/src/test/resources/application.properties

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ hibernate.hbm2ddl.auto=create-drop
1919
hibernate.cache.use_second_level_cache=true
2020
hibernate.cache.use_query_cache=true
2121
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
22+
hibernate.globally_quoted_identifiers=true
2223

2324
spring.jpa.properties.hibernate.hbm2ddl.import_files=import_books.sql
2425
spring.sql.init.data-locations=import_*_users.sql
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
insert into EMPLOYEES values(1, 'Harsha', 'Developer');
2-
insert into EMPLOYEES values(2, 'John', 'Tester');
3-
insert into EMPLOYEES values(3, 'Ram', 'Manager');
1+
delete from "employees";
2+
3+
insert into "employees" values(1, 'Harsha', 'Developer');
4+
insert into "employees" values(2, 'John', 'Tester');
5+
insert into "employees" values(3, 'Ram', 'Manager');
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
insert into EMPLOYEES values(4, 'Eric', 'Senior Developer');
2-
insert into EMPLOYEES values(5, 'Vidhyaah', 'Senior Manager');
1+
insert into "employees" values(4, 'Eric', 'Senior Developer');
2+
insert into "employees" values(5, 'Vidhyaah', 'Senior Manager');
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
create table person (
2-
id integer identity primary key,
2+
id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
33
first_name varchar(30),
44
last_name varchar(30)
55
);

persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public interface CompanyRepository extends JpaRepository<Company, Integer> {
1313
@Query("SELECT C FROM Company C WHERE C.contactPerson.firstName = ?1")
1414
List<Company> findByContactPersonFirstNameWithJPQL(String firstName);
1515

16-
@Query(value = "SELECT * FROM company WHERE contact_first_name = ?1", nativeQuery = true)
16+
@Query(value = "SELECT * FROM \"company\" WHERE \"contact_first_name\" = ?1", nativeQuery = true)
1717
List<Company> findByContactPersonFirstNameWithNativeQuery(String firstName);
1818
}

persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ spring.jpa.properties.hibernate.jdbc.batch_size=4
44
spring.jpa.properties.hibernate.order_inserts=true
55
spring.jpa.properties.hibernate.order_updates=true
66
spring.jpa.properties.hibernate.generate_statistics=true
7+
8+
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
2121

2222
@Query("SELECT u FROM User u WHERE u.status = 1")
2323
Collection<User> findAllActiveUsers();
24-
24+
2525
@Query("select u from User u where u.email like '%@gmail.com'")
2626
List<User> findUsersWithGmailAddress();
2727

@@ -75,14 +75,14 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
7575
@Query(value = "INSERT INTO Users (name, age, email, status, active) VALUES (:name, :age, :email, :status, :active)", nativeQuery = true)
7676
@Modifying
7777
void insertUser(@Param("name") String name, @Param("age") Integer age, @Param("email") String email, @Param("status") Integer status, @Param("active") boolean active);
78-
78+
7979
@Modifying
8080
@Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true)
8181
int updateUserSetStatusForNameNativePostgres(Integer status, String name);
82-
82+
8383
@Query(value = "SELECT u FROM User u WHERE u.name IN :names")
8484
List<User> findUserByNameList(@Param("names") Collection<String> names);
85-
85+
8686
void deleteAllByCreationDateAfter(LocalDate date);
8787

8888
@Modifying(clearAutomatically = true, flushAutomatically = true)
@@ -97,6 +97,6 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
9797
int deleteDeactivatedUsersWithNoModifyingAnnotation();
9898

9999
@Modifying(clearAutomatically = true, flushAutomatically = true)
100-
@Query(value = "alter table USERS add column deleted int(1) not null default 0", nativeQuery = true)
100+
@Query(value = "alter table USERS add column deleted int not null default 0", nativeQuery = true)
101101
void addDeletedColumn();
102102
}

persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ final Properties additionalProperties() {
6262
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
6363
hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache"));
6464
hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache"));
65+
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
6566

6667
return hibernateProperties;
6768
}

persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ hibernate.show_sql=true
66
hibernate.hbm2ddl.auto=create
77

88
hibernate.cache.use_second_level_cache=false
9-
hibernate.cache.use_query_cache=false
9+
hibernate.cache.use_query_cache=false
10+
11+
hibernate.globally_quoted_identifiers=true

persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public PersistenceConfig() {
6464
public AuditorAware<String> auditorProvider() {
6565
return new AuditorAwareImpl();
6666
}
67-
67+
6868
@Bean
6969
public LocalSessionFactoryBean sessionFactory() {
7070
final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
@@ -175,7 +175,7 @@ private final Properties hibernateProperties() {
175175

176176
hibernateProperties.setProperty("hibernate.show_sql", "true");
177177
// hibernateProperties.setProperty("hibernate.format_sql", "true");
178-
// hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
178+
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
179179

180180
// Envers properties
181181
hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix"));

persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
1313
<property name="show_sql">true</property>
1414
<property name="hbm2ddl.auto">validate</property>
15-
16-
15+
<property name="hibernate.globally_quoted_identifiers">true</property>
16+
1717
<mapping class="com.baeldung.hibernate.fetching.model.UserEager" />
1818
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetailEager" />
1919
</session-factory>

persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<property name="hibernate.connection.password">iamtheking</property>
1212
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
1313
<property name="show_sql">true</property>
14+
<property name="hibernate.globally_quoted_identifiers">true</property>
1415
<mapping class="com.baeldung.hibernate.fetching.model.UserLazy" />
1516
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" />
1617
</session-factory>

0 commit comments

Comments
 (0)