From 7f6b12abcb5f907c8b4e49179e461f2b1fcc6028 Mon Sep 17 00:00:00 2001 From: Haroon Khan Date: Thu, 25 Aug 2022 17:00:13 +0100 Subject: [PATCH] [JAVA-13976] Fix integration tests after Spring Boot upgrade to 2.7.2 (#12647) --- .../src/main/resources/application.yml | 7 ++++-- apache-olingo/src/main/resources/data.sql | 18 +++++++-------- libraries-data-db/pom.xml | 3 +-- libraries-data-db/src/main/resources/db.sql | 12 +++++----- persistence-modules/r2dbc/pom.xml | 5 ----- ...lication-lazy-load-no-trans-off.properties | 1 + ...plication-lazy-load-no-trans-on.properties | 1 + .../application-persistent-on.properties | 1 + .../src/main/resources/application.properties | 2 ++ .../src/main/resources/application.yaml | 3 +++ .../src/main/resources/data-h2.sql | 10 ++++----- .../src/main/resources/data-trans.sql | 22 +++++++++---------- .../spring-boot-persistence-mongodb/pom.xml | 5 ----- .../com/baeldung/boot/config/H2JpaConfig.java | 1 + .../src/main/resources/application.properties | 4 +++- .../SpringBootProfileIntegrationTest.java | 2 +- .../config/H2TestProfileJPAConfig.java | 1 + ...BootSqlGroupAnnotationIntegrationTest.java | 6 +++-- .../src/test/resources/application.properties | 1 + .../src/test/resources/import_employees.sql | 8 ++++--- .../resources/import_senior_employees.sql | 4 ++-- .../src/main/resources/schema.sql | 2 +- .../repositories/CompanyRepository.java | 2 +- .../src/main/resources/application.properties | 2 ++ .../src/main/resources/application.properties | 1 + .../boot/daos/user/UserRepository.java | 10 ++++----- .../com/baeldung/config/StudentJpaConfig.java | 1 + .../resources/persistence-student.properties | 4 +++- .../baeldung/config/PersistenceConfig.java | 4 ++-- .../src/main/resources/fetching.cfg.xml | 4 ++-- .../src/main/resources/fetchingLazy.cfg.xml | 1 + .../src/main/resources/insert_users.sql | 12 +++++----- .../HibernateFetchingIntegrationTest.java | 2 +- .../src/test/resources/fetching.cfg.xml | 3 ++- .../src/test/resources/fetchingLazy.cfg.xml | 1 + .../src/main/resources/import_entities.sql | 6 ++--- .../repository/CommentRepository.java | 2 +- .../src/main/resources/application.properties | 4 +++- .../src/main/resources/db/import_joins.sql | 18 +++++++-------- .../src/test/resources/entitygraph-data.sql | 12 +++++----- .../test/resources/test-aggregation-data.sql | 14 ++++++------ .../src/test/resources/test-movie-cleanup.sql | 2 +- .../src/test/resources/test-movie-data.sql | 14 ++++++------ .../src/main/resources/schema-all.sql | 2 +- .../baeldung/openapi/OpenApiApplication.java | 15 +++++++++++++ .../main/java/com/baeldung/sprq/SpqrApp.java | 3 +++ .../openapi/OpenApiPetsIntegrationTest.java | 2 +- .../spring-boot-properties/pom.xml | 2 +- .../spring-boot-runtime/pom.xml | 6 +---- 49 files changed, 150 insertions(+), 118 deletions(-) create mode 100644 persistence-modules/spring-data-jpa-crud-2/src/main/resources/application.properties create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/OpenApiApplication.java diff --git a/apache-olingo/src/main/resources/application.yml b/apache-olingo/src/main/resources/application.yml index 3e09ea8dd5..e97fec0031 100644 --- a/apache-olingo/src/main/resources/application.yml +++ b/apache-olingo/src/main/resources/application.yml @@ -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: diff --git a/apache-olingo/src/main/resources/data.sql b/apache-olingo/src/main/resources/data.sql index 327f2688c5..e872cec10f 100644 --- a/apache-olingo/src/main/resources/data.sql +++ b/apache-olingo/src/main/resources/data.sql @@ -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; \ No newline at end of file +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); diff --git a/libraries-data-db/pom.xml b/libraries-data-db/pom.xml index c0f2848705..8e5140458e 100644 --- a/libraries-data-db/pom.xml +++ b/libraries-data-db/pom.xml @@ -159,7 +159,6 @@ classname="com.gs.fw.common.mithra.generator.MithraGenerator" /> @@ -268,7 +267,7 @@ 11.11.2 - 16.5.1 + 18.1.0 3.0.0 1.8 5.0 diff --git a/libraries-data-db/src/main/resources/db.sql b/libraries-data-db/src/main/resources/db.sql index e6a9ed3fc2..7bcf6f816e 100644 --- a/libraries-data-db/src/main/resources/db.sql +++ b/libraries-data-db/src/main/resources/db.sql @@ -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 ); diff --git a/persistence-modules/r2dbc/pom.xml b/persistence-modules/r2dbc/pom.xml index 1ce5eb3e96..f32b37974b 100644 --- a/persistence-modules/r2dbc/pom.xml +++ b/persistence-modules/r2dbc/pom.xml @@ -39,7 +39,6 @@ io.r2dbc r2dbc-h2 - ${r2dbc-h2.version} org.springframework.boot @@ -61,8 +60,4 @@ - - 0.8.1.RELEASE - - \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties index a1243dc1df..b030527cca 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties @@ -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 \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties index 2ea89b2ee6..972a7bb0f3 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties @@ -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 \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties index be939ffa69..e745c7455e 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties @@ -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 diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties index 2499d7cd06..4dd2caf075 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.properties @@ -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 diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.yaml b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.yaml index aeb33f797a..1b8cfbb558 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.yaml +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application.yaml @@ -12,3 +12,6 @@ spring: driverClassName: org.h2.Driver jpa: spring.jpa.database-platform: org.hibernate.dialect.H2Dialect + properties: + hibernate: + globally_quoted_identifiers: true diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-h2.sql b/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-h2.sql index 3d04b578d2..2566a8d125 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-h2.sql +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-h2.sql @@ -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'); \ No newline at end of file +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'); \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql b/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql index e4fda99437..2b4aa92542 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql @@ -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); \ No newline at end of file +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); \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence-mongodb/pom.xml b/persistence-modules/spring-boot-persistence-mongodb/pom.xml index 8b36474777..724fa38f7e 100644 --- a/persistence-modules/spring-boot-persistence-mongodb/pom.xml +++ b/persistence-modules/spring-boot-persistence-mongodb/pom.xml @@ -32,13 +32,8 @@ de.flapdoodle.embed de.flapdoodle.embed.mongo - ${embed.mongo.version} test - - 3.2.6 - - \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java index 6325d2cd2e..d3a09c08ff 100644 --- a/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java +++ b/persistence-modules/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java @@ -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; } diff --git a/persistence-modules/spring-boot-persistence/src/main/resources/application.properties b/persistence-modules/spring-boot-persistence/src/main/resources/application.properties index 7b5a467a2b..52bfc00712 100644 --- a/persistence-modules/spring-boot-persistence/src/main/resources/application.properties +++ b/persistence-modules/spring-boot-persistence/src/main/resources/application.properties @@ -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 \ No newline at end of file +spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + +hibernate.globally_quoted_identifiers=true diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java index d7bb44e133..226a5a550a 100644 --- a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java @@ -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); diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/config/H2TestProfileJPAConfig.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/config/H2TestProfileJPAConfig.java index f73000a10e..515350fe0a 100644 --- a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/config/H2TestProfileJPAConfig.java +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/config/H2TestProfileJPAConfig.java @@ -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; } diff --git a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationIntegrationTest.java b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationIntegrationTest.java index 0153d463a2..e584645742 100644 --- a/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationIntegrationTest.java +++ b/persistence-modules/spring-boot-persistence/src/test/java/com/baeldung/springbootinitialload/tests/SpringBootSqlGroupAnnotationIntegrationTest.java @@ -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 diff --git a/persistence-modules/spring-boot-persistence/src/test/resources/application.properties b/persistence-modules/spring-boot-persistence/src/test/resources/application.properties index b268f46094..9f6f3f60d2 100644 --- a/persistence-modules/spring-boot-persistence/src/test/resources/application.properties +++ b/persistence-modules/spring-boot-persistence/src/test/resources/application.properties @@ -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 \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/src/test/resources/import_employees.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_employees.sql index 40442d2804..f234d02fd9 100644 --- a/persistence-modules/spring-boot-persistence/src/test/resources/import_employees.sql +++ b/persistence-modules/spring-boot-persistence/src/test/resources/import_employees.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'); \ No newline at end of file +delete from "employees"; + +insert into "employees" values(1, 'Harsha', 'Developer'); +insert into "employees" values(2, 'John', 'Tester'); +insert into "employees" values(3, 'Ram', 'Manager'); \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/src/test/resources/import_senior_employees.sql b/persistence-modules/spring-boot-persistence/src/test/resources/import_senior_employees.sql index 3d0819175b..e4af4651a7 100644 --- a/persistence-modules/spring-boot-persistence/src/test/resources/import_senior_employees.sql +++ b/persistence-modules/spring-boot-persistence/src/test/resources/import_senior_employees.sql @@ -1,2 +1,2 @@ -insert into EMPLOYEES values(4, 'Eric', 'Senior Developer'); -insert into EMPLOYEES values(5, 'Vidhyaah', 'Senior Manager'); \ No newline at end of file +insert into "employees" values(4, 'Eric', 'Senior Developer'); +insert into "employees" values(5, 'Vidhyaah', 'Senior Manager'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jdbc/src/main/resources/schema.sql b/persistence-modules/spring-data-jdbc/src/main/resources/schema.sql index 5618822bf9..2c431d2340 100644 --- a/persistence-modules/spring-data-jdbc/src/main/resources/schema.sql +++ b/persistence-modules/spring-data-jdbc/src/main/resources/schema.sql @@ -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) ); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java index f456b15652..cfef3a6a5e 100644 --- a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java @@ -13,6 +13,6 @@ public interface CompanyRepository extends JpaRepository { @Query("SELECT C FROM Company C WHERE C.contactPerson.firstName = ?1") List 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 findByContactPersonFirstNameWithNativeQuery(String firstName); } diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties index f127dd5e50..6f871a25b7 100644 --- a/persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties +++ b/persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties @@ -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 diff --git a/persistence-modules/spring-data-jpa-crud-2/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-crud-2/src/main/resources/application.properties new file mode 100644 index 0000000000..ead0df89a3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud-2/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.jpa.properties.hibernate.globally_quoted_identifiers=true diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java index cfa99414c6..a2c816b1c4 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java @@ -21,7 +21,7 @@ public interface UserRepository extends JpaRepository , UserRepos @Query("SELECT u FROM User u WHERE u.status = 1") Collection findAllActiveUsers(); - + @Query("select u from User u where u.email like '%@gmail.com'") List findUsersWithGmailAddress(); @@ -75,14 +75,14 @@ public interface UserRepository extends JpaRepository , 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 findUserByNameList(@Param("names") Collection names); - + void deleteAllByCreationDateAfter(LocalDate date); @Modifying(clearAutomatically = true, flushAutomatically = true) @@ -97,6 +97,6 @@ public interface UserRepository extends JpaRepository , 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(); } diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java index 08f37ea806..bcb3b2fc8c 100644 --- a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java @@ -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; } diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties b/persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties index 3b6b580630..a2a83f5dee 100644 --- a/persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties +++ b/persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties @@ -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 \ No newline at end of file +hibernate.cache.use_query_cache=false + +hibernate.globally_quoted_identifiers=true diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java index a0d70ed006..64fe4d7724 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java @@ -64,7 +64,7 @@ public class PersistenceConfig { public AuditorAware 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")); diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml index 1b9a4a191c..dcc3e76cf5 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml @@ -12,8 +12,8 @@ org.hibernate.dialect.MySQLDialect true validate - - + true + diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml index c5f608e1a7..8fe08b10c3 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml @@ -11,6 +11,7 @@ iamtheking org.hibernate.dialect.MySQLDialect true + true diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_users.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_users.sql index 330b2e36b0..e0aca9ac41 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_users.sql +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_users.sql @@ -1,8 +1,8 @@ -insert into Users(id, name, creation_date, last_login_date, active, age, email, status) -values(1, 'John', TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('01/01/2020', 'DD/MM/YYYY'), 1, 23, 'john@email.com', 1); +insert into Users(name, creation_date, last_login_date, active, age, email, status) +values('John', PARSEDATETIME('01/01/2018', 'dd/MM/yyyy'), PARSEDATETIME('01/01/2020', 'dd/MM/yyyy'), 1, 23, 'john@email.com', 1); -insert into Users(id, name, creation_date, last_login_date, active, age, email, status) -values(2, 'Bob', TO_DATE('02/02/2019', 'DD/MM/YYYY'), TO_DATE('02/02/2020', 'DD/MM/YYYY'), 1, 56, 'bob@email.com', 1); +insert into Users(name, creation_date, last_login_date, active, age, email, status) +values('Bob', PARSEDATETIME('02/02/2019', 'dd/MM/yyyy'), PARSEDATETIME('02/02/2020', 'dd/MM/yyyy'), 1, 56, 'bob@email.com', 1); -insert into Users(id, name, creation_date, last_login_date, active, age, email, status) -values(3, 'Cindy', TO_DATE('02/02/2019', 'DD/MM/YYYY'), TO_DATE('02/02/2020', 'DD/MM/YYYY'), 1, 18, 'cindy@email.com', 0); \ No newline at end of file +insert into Users(name, creation_date, last_login_date, active, age, email, status) +values('Cindy', PARSEDATETIME('02/02/2019', 'dd/MM/yyyy'), PARSEDATETIME('02/02/2020', 'dd/MM/yyyy'), 1, 18, 'cindy@email.com', 0); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java index 65bf36f8bf..e90207a170 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java @@ -15,7 +15,7 @@ public class HibernateFetchingIntegrationTest { // this loads sample data in the database @Before - public void addFecthingTestData() { + public void addFetchingTestData() { FetchingAppView fav = new FetchingAppView(); fav.createTestData(); } diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml index 4d3ff2ae63..c14a3ecd7a 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml +++ b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml @@ -12,7 +12,8 @@ org.hibernate.dialect.H2Dialect update false - + true + diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml index 8a2bf593cb..ad6ee0ed46 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml +++ b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml @@ -12,6 +12,7 @@ org.hibernate.dialect.H2Dialect update false + true diff --git a/persistence-modules/spring-data-jpa-query-3/src/main/resources/import_entities.sql b/persistence-modules/spring-data-jpa-query-3/src/main/resources/import_entities.sql index 4fe18bf4aa..ce71bc744c 100644 --- a/persistence-modules/spring-data-jpa-query-3/src/main/resources/import_entities.sql +++ b/persistence-modules/spring-data-jpa-query-3/src/main/resources/import_entities.sql @@ -1,3 +1,3 @@ -insert into Article(id, publication_date, publication_time, creation_date_time) values(1, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:00', 'HH24:MI'), TO_DATE('31/12/2017 07:30', 'DD/MM/YYYY HH24:MI')); -insert into Article(id, publication_date, publication_time, creation_date_time) values(2, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:30', 'HH24:MI'), TO_DATE('15/12/2017 08:00', 'DD/MM/YYYY HH24:MI')); -insert into Article(id, publication_date, publication_time, creation_date_time) values(3, TO_DATE('15/12/2017', 'DD/MM/YYYY'), TO_DATE('16:00', 'HH24:MI'), TO_DATE('01/12/2017 13:45', 'DD/MM/YYYY HH24:MI')); \ No newline at end of file +insert into Article(id, publication_date, publication_time, creation_date_time) values(1, PARSEDATETIME('01/01/2018', 'dd/MM/yyyy'), PARSEDATETIME('15:00', 'HH:mm'), PARSEDATETIME('31/12/2017 07:30', 'dd/MM/yyyy HH:mm')); +insert into Article(id, publication_date, publication_time, creation_date_time) values(2, PARSEDATETIME('01/01/2018', 'dd/MM/yyyy'), PARSEDATETIME('15:30', 'HH:mm'), PARSEDATETIME('15/12/2017 08:00', 'dd/MM/yyyy HH:mm')); +insert into Article(id, publication_date, publication_time, creation_date_time) values(3, PARSEDATETIME('15/12/2017', 'dd/MM/yyyy'), PARSEDATETIME('16:00', 'HH:mm'), PARSEDATETIME('01/12/2017 13:45', 'dd/MM/yyyy HH:mm')); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java index 89e9345e94..5309581638 100644 --- a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java @@ -21,7 +21,7 @@ public interface CommentRepository extends JpaRepository { @Query("SELECT c.year AS yearComment, COUNT(c.year) AS totalComment FROM Comment AS c GROUP BY c.year ORDER BY c.year DESC") List countTotalCommentsByYearInterface(); - @Query(value = "SELECT c.year AS yearComment, COUNT(c.*) AS totalComment FROM comment AS c GROUP BY c.year ORDER BY c.year DESC", nativeQuery = true) + @Query(value = "SELECT c.\"year\" AS yearComment, COUNT(c.*) AS totalComment FROM \"comment\" AS c GROUP BY c.\"year\" ORDER BY c.\"year\" DESC", nativeQuery = true) List countTotalCommentsByYearNative(); } diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-query/src/main/resources/application.properties index eb0e519ef0..7850367c64 100644 --- a/persistence-modules/spring-data-jpa-query/src/main/resources/application.properties +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/application.properties @@ -1,2 +1,4 @@ spring.jpa.show-sql=false -spring.jpa.defer-datasource-initialization=true \ No newline at end of file +spring.jpa.defer-datasource-initialization=true + +spring.jpa.properties.hibernate.globally_quoted_identifiers=true diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql b/persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql index e4772d6ff2..7598064278 100644 --- a/persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql @@ -1,13 +1,13 @@ -INSERT INTO department (id, name) VALUES (1, 'Infra'); -INSERT INTO department (id, name) VALUES (2, 'Accounting'); -INSERT INTO department (id, name) VALUES (3, 'Management'); +INSERT INTO "department" ("id", "name") VALUES (1, 'Infra'); +INSERT INTO "department" ("id", "name") VALUES (2, 'Accounting'); +INSERT INTO "department" ("id", "name") VALUES (3, 'Management'); -INSERT INTO joins_employee (id, name, age, department_id) VALUES (1, 'Baeldung', '35', 1); -INSERT INTO joins_employee (id, name, age, department_id) VALUES (2, 'John', '35', 2); -INSERT INTO joins_employee (id, name, age, department_id) VALUES (3, 'Jane', '35', 2); +INSERT INTO "joins_employee" ("id", "name", "age", "department_id") VALUES (1, 'Baeldung', '35', 1); +INSERT INTO "joins_employee" ("id", "name", "age", "department_id") VALUES (2, 'John', '35', 2); +INSERT INTO "joins_employee" ("id", "name", "age", "department_id") VALUES (3, 'Jane', '35', 2); -INSERT INTO phone (id, number, employee_id) VALUES (1, '111', 1); -INSERT INTO phone (id, number, employee_id) VALUES (2, '222', 1); -INSERT INTO phone (id, number, employee_id) VALUES (3, '333', 1); +INSERT INTO "phone" ("id", "number", "employee_id") VALUES (1, '111', 1); +INSERT INTO "phone" ("id", "number", "employee_id") VALUES (2, '222', 1); +INSERT INTO "phone" ("id", "number", "employee_id") VALUES (3, '333', 1); COMMIT; diff --git a/persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql b/persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql index 685ec2c605..73994d88cc 100644 --- a/persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql +++ b/persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql @@ -1,7 +1,7 @@ -INSERT INTO Item(id,name) VALUES (1,'Table'); -INSERT INTO Item(id,name) VALUES (2,'Bottle'); +INSERT INTO "item" ("id", "name") VALUES (1,'Table'); +INSERT INTO "item" ("id", "name") VALUES (2,'Bottle'); -INSERT INTO Characteristic(id,item_id, type) VALUES (1,1,'Rigid'); -INSERT INTO Characteristic(id,item_id,type) VALUES (2,1,'Big'); -INSERT INTO Characteristic(id,item_id,type) VALUES (3,2,'Fragile'); -INSERT INTO Characteristic(id,item_id,type) VALUES (4,2,'Small'); \ No newline at end of file +INSERT INTO "characteristic" ("id", "item_id", "type") VALUES (1,1,'Rigid'); +INSERT INTO "characteristic" ("id", "item_id", "type") VALUES (2,1,'Big'); +INSERT INTO "characteristic" ("id", "item_id", "type") VALUES (3,2,'Fragile'); +INSERT INTO "characteristic" ("id", "item_id", "type") VALUES (4,2,'Small'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql b/persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql index 12409a124e..ece64240ae 100644 --- a/persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql +++ b/persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql @@ -1,7 +1,7 @@ -INSERT INTO post (id, title, content) VALUES (1, 'Comment 1', 'Content 1'); -INSERT INTO post (id, title, content) VALUES (2, 'Comment 2', 'Content 2'); -INSERT INTO post (id, title, content) VALUES (3, 'Comment 3', 'Content 3'); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (1, 2019, false, 'Comment 1', 1); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (2, 2018, true, 'Comment 2', 1); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (3, 2018, true, 'Comment 3', 2); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (4, 2017, false, 'Comment 4', 3); \ No newline at end of file +INSERT INTO "post" ("id", "title", "content") VALUES (1, 'Comment 1', 'Content 1'); +INSERT INTO "post" ("id", "title", "content") VALUES (2, 'Comment 2', 'Content 2'); +INSERT INTO "post" ("id", "title", "content") VALUES (3, 'Comment 3', 'Content 3'); +INSERT INTO "comment" ("id", "year", "approved", "content", "post_id") VALUES (1, 2019, false, 'Comment 1', 1); +INSERT INTO "comment" ("id", "year", "approved", "content", "post_id") VALUES (2, 2018, true, 'Comment 2', 1); +INSERT INTO "comment" ("id", "year", "approved", "content", "post_id") VALUES (3, 2018, true, 'Comment 3', 2); +INSERT INTO "comment" ("id", "year", "approved", "content", "post_id") VALUES (4, 2017, false, 'Comment 4', 3); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-cleanup.sql b/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-cleanup.sql index 90aa15307c..0ba0ba0694 100644 --- a/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-cleanup.sql +++ b/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-cleanup.sql @@ -1 +1 @@ -DELETE FROM Movie; \ No newline at end of file +DELETE FROM "movie"; \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-data.sql b/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-data.sql index 37f8e4fe64..0eb9638f43 100644 --- a/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-data.sql +++ b/persistence-modules/spring-data-jpa-repo-2/src/test/resources/test-movie-data.sql @@ -1,7 +1,7 @@ -INSERT INTO movie(id, title, director, rating, duration) VALUES(1, 'Godzilla: King of the Monsters', ' Michael Dougherty', 'PG-13', 132); -INSERT INTO movie(id, title, director, rating, duration) VALUES(2, 'Avengers: Endgame', 'Anthony Russo', 'PG-13', 181); -INSERT INTO movie(id, title, director, rating, duration) VALUES(3, 'Captain Marvel', 'Anna Boden', 'PG-13', 123); -INSERT INTO movie(id, title, director, rating, duration) VALUES(4, 'Dumbo', 'Tim Burton', 'PG', 112); -INSERT INTO movie(id, title, director, rating, duration) VALUES(5, 'Booksmart', 'Olivia Wilde', 'R', 102); -INSERT INTO movie(id, title, director, rating, duration) VALUES(6, 'Aladdin', 'Guy Ritchie', 'PG', 128); -INSERT INTO movie(id, title, director, rating, duration) VALUES(7, 'The Sun Is Also a Star', 'Ry Russo-Young', 'PG-13', 100); +INSERT INTO "movie" ("id", "title", "director", "rating", "duration") VALUES(1, 'Godzilla: King of the Monsters', ' Michael Dougherty', 'PG-13', 132); +INSERT INTO "movie" ("id", "title", "director", "rating", "duration") VALUES(2, 'Avengers: Endgame', 'Anthony Russo', 'PG-13', 181); +INSERT INTO "movie" ("id", "title", "director", "rating", "duration") VALUES(3, 'Captain Marvel', 'Anna Boden', 'PG-13', 123); +INSERT INTO "movie" ("id", "title", "director", "rating", "duration") VALUES(4, 'Dumbo', 'Tim Burton', 'PG', 112); +INSERT INTO "movie" ("id", "title", "director", "rating", "duration") VALUES(5, 'Booksmart', 'Olivia Wilde', 'R', 102); +INSERT INTO "movie" ("id", "title", "director", "rating", "duration") VALUES(6, 'Aladdin', 'Guy Ritchie', 'PG', 128); +INSERT INTO "movie" ("id", "title", "director", "rating", "duration") VALUES(7, 'The Sun Is Also a Star', 'Ry Russo-Young', 'PG-13', 100); diff --git a/spring-batch-2/src/main/resources/schema-all.sql b/spring-batch-2/src/main/resources/schema-all.sql index 9f698f7d81..c17b9f9749 100644 --- a/spring-batch-2/src/main/resources/schema-all.sql +++ b/spring-batch-2/src/main/resources/schema-all.sql @@ -1,7 +1,7 @@ DROP TABLE coffee IF EXISTS; CREATE TABLE coffee ( - coffee_id BIGINT IDENTITY NOT NULL PRIMARY KEY, + coffee_id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, brand VARCHAR(20), origin VARCHAR(20), characteristics VARCHAR(30) diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/OpenApiApplication.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/OpenApiApplication.java new file mode 100644 index 0000000000..3fd8dbd6c5 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/OpenApiApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.openapi; + +import org.jobrunr.autoconfigure.JobRunrAutoConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableAutoConfiguration(exclude = { JobRunrAutoConfiguration.class}) +public class OpenApiApplication { + + public static void main(String[] args) { + SpringApplication.run(OpenApiApplication.class, args); + } +} diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/sprq/SpqrApp.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/sprq/SpqrApp.java index 4a205dcc1f..ec471aa8eb 100644 --- a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/sprq/SpqrApp.java +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/sprq/SpqrApp.java @@ -1,9 +1,12 @@ package com.baeldung.sprq; +import org.jobrunr.autoconfigure.JobRunrAutoConfiguration; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication +@EnableAutoConfiguration(exclude = { JobRunrAutoConfiguration.class}) public class SpqrApp { public static void main(String[] args) { diff --git a/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java index b56c19d94c..e56ff445d7 100644 --- a/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java +++ b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/openapi/OpenApiPetsIntegrationTest.java @@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @RunWith(SpringRunner.class) -@SpringBootTest +@SpringBootTest(classes = OpenApiApplication.class) @AutoConfigureMockMvc public class OpenApiPetsIntegrationTest { diff --git a/spring-boot-modules/spring-boot-properties/pom.xml b/spring-boot-modules/spring-boot-properties/pom.xml index 41baf3bb82..378864a1df 100644 --- a/spring-boot-modules/spring-boot-properties/pom.xml +++ b/spring-boot-modules/spring-boot-properties/pom.xml @@ -122,7 +122,7 @@ - 2021.0.0 + 2021.0.3 1.10 @ diff --git a/spring-boot-modules/spring-boot-runtime/pom.xml b/spring-boot-modules/spring-boot-runtime/pom.xml index 04c8ddc525..7b2ed6976b 100644 --- a/spring-boot-modules/spring-boot-runtime/pom.xml +++ b/spring-boot-modules/spring-boot-runtime/pom.xml @@ -71,7 +71,6 @@ javax.persistence javax.persistence-api - ${jpa.version} com.google.guava @@ -87,15 +86,12 @@ org.apache.httpcomponents httpclient - ${httpclient.version} - 2.2 3.1.7 - 3.1.0 - 4.5.8 + 3.1.3 \ No newline at end of file