[JAVA-13976] Fix integration tests after Spring Boot upgrade to 2.7.2 (#12647)
This commit is contained in:
parent
e151d4d1d0
commit
7f6b12abcb
|
@ -11,6 +11,9 @@ spring:
|
|||
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>
|
||||
|
|
|
@ -29,22 +29,22 @@ 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>
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -9,3 +9,5 @@ spring.h2.console.enabled=true
|
|||
|
||||
# Uppercase Table Names
|
||||
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||
|
||||
hibernate.globally_quoted_identifiers=true
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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');
|
|
@ -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)
|
||||
);
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -7,3 +7,5 @@ hibernate.hbm2ddl.auto=create
|
|||
|
||||
hibernate.cache.use_second_level_cache=false
|
||||
hibernate.cache.use_query_cache=false
|
||||
|
||||
hibernate.globally_quoted_identifiers=true
|
||||
|
|
|
@ -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,7 +12,7 @@
|
|||
<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" />
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<property name="hibernate.connection.password">iamtheking</property>
|
||||
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
|
||||
<property name="show_sql">true</property>
|
||||
<property name="hibernate.globally_quoted_identifiers">true</property>
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.UserLazy" />
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" />
|
||||
</session-factory>
|
||||
|
|
|
@ -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);
|
||||
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);
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
|
||||
<property name="hibernate.hbm2ddl.auto">update</property>
|
||||
<property name="show_sql">false</property>
|
||||
<property name="hibernate.globally_quoted_identifiers">true</property>
|
||||
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.UserEager" />
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" />
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
|
||||
<property name="hibernate.hbm2ddl.auto">update</property>
|
||||
<property name="show_sql">false</property>
|
||||
<property name="hibernate.globally_quoted_identifiers">true</property>
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.UserLazy" />
|
||||
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" />
|
||||
|
||||
|
|
|
@ -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'));
|
||||
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'));
|
|
@ -21,7 +21,7 @@ public interface CommentRepository extends JpaRepository<Comment, Integer> {
|
|||
@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<ICommentCount> 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<ICommentCount> countTotalCommentsByYearNative();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
spring.jpa.show-sql=false
|
||||
spring.jpa.defer-datasource-initialization=true
|
||||
|
||||
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
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');
|
|
@ -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);
|
||||
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);
|
|
@ -1 +1 @@
|
|||
DELETE FROM Movie;
|
||||
DELETE FROM "movie";
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
</profiles>
|
||||
|
||||
<properties>
|
||||
<spring-cloud.version>2021.0.0</spring-cloud.version>
|
||||
<spring-cloud.version>2021.0.3</spring-cloud.version>
|
||||
<commons-configuration.version>1.10</commons-configuration.version>
|
||||
<resource.delimiter>@</resource.delimiter>
|
||||
<!-- <start-class>com.baeldung.buildproperties.Application</start-class> -->
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
<dependency>
|
||||
<groupId>javax.persistence</groupId>
|
||||
<artifactId>javax.persistence-api</artifactId>
|
||||
<version>${jpa.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
|
@ -87,15 +86,12 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<jpa.version>2.2</jpa.version>
|
||||
<subethasmtp.version>3.1.7</subethasmtp.version>
|
||||
<springcloud.version>3.1.0</springcloud.version>
|
||||
<httpclient.version>4.5.8</httpclient.version>
|
||||
<springcloud.version>3.1.3</springcloud.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue