Merge branch 'eugenp:master' into master

This commit is contained in:
Asjad J 2022-08-25 22:06:22 +05:00 committed by GitHub
commit 9d308ba331
126 changed files with 433 additions and 333 deletions

View File

@ -11,6 +11,9 @@ spring:
open-in-view: false open-in-view: false
hibernate: hibernate:
ddl-auto: update ddl-auto: update
properties:
hibernate:
globally_quoted_identifiers: true
sql: sql:
init: init:

View File

@ -1,12 +1,10 @@
insert into car_maker(id,name) values (1,'Special Motors'); 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 (2,'BWM');
insert into car_maker(id,name) values (3,'Dolores'); 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(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(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(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(5,2,'BWM-200','BWM200',2009);
insert into car_model(id,maker_fk,name,sku,year) values(6,2,'BWM-300','BWM300',2008); insert into "car_model"("id", "maker_fk", "name", "sku", "year") values(6,2,'BWM-300','BWM300',2008);
alter sequence hibernate_sequence restart with 100;

View File

@ -159,7 +159,6 @@
classname="com.gs.fw.common.mithra.generator.MithraGenerator" /> classname="com.gs.fw.common.mithra.generator.MithraGenerator" />
<gen-reladomo <gen-reladomo
xml="${project.basedir}/src/main/resources/reladomo/ReladomoClassList.xml" xml="${project.basedir}/src/main/resources/reladomo/ReladomoClassList.xml"
generateGscListMethod="true"
generatedDir="${project.build.directory}/generated-sources/reladomo" generatedDir="${project.build.directory}/generated-sources/reladomo"
nonGeneratedDir="${project.basedir}/src/main/java" /> nonGeneratedDir="${project.basedir}/src/main/java" />
@ -268,7 +267,7 @@
<properties> <properties>
<ebean.plugin.version>11.11.2</ebean.plugin.version> <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> <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version> <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
<ormlite.version>5.0</ormlite.version> <ormlite.version>5.0</ormlite.version>

View File

@ -29,22 +29,22 @@ insert into dept values(40, 'OPERATIONS', 'BOSTON');
insert into emp values( insert into emp values(
7839, 'KING', 'PRESIDENT', null, 7839, 'KING', 'PRESIDENT', null,
to_date('17-11-1981','dd-mm-yyyy'), parsedatetime('17-11-1981','dd-MM-yyyy'),
7698, null, 10 7698, null, 10
); );
insert into emp values( insert into emp values(
7698, 'BLAKE', 'MANAGER', 7839, 7698, 'BLAKE', 'MANAGER', 7839,
to_date('1-5-1981','dd-mm-yyyy'), parsedatetime('01-05-1981','dd-MM-yyyy'),
7782, null, 20 7782, null, 20
); );
insert into emp values( insert into emp values(
7782, 'CLARK', 'MANAGER', 7839, 7782, 'CLARK', 'MANAGER', 7839,
to_date('9-6-1981','dd-mm-yyyy'), parsedatetime('09-06-1981','dd-MM-yyyy'),
7566, null, 30 7566, null, 30
); );
insert into emp values( insert into emp values(
7566, 'JONES', 'MANAGER', 7839, 7566, 'JONES', 'MANAGER', 7839,
to_date('2-4-1981','dd-mm-yyyy'), parsedatetime('02-04-1981','dd-MM-yyyy'),
7839, null, 40 7839, null, 40
); );

View File

@ -39,7 +39,6 @@
<dependency> <dependency>
<groupId>io.r2dbc</groupId> <groupId>io.r2dbc</groupId>
<artifactId>r2dbc-h2</artifactId> <artifactId>r2dbc-h2</artifactId>
<version>${r2dbc-h2.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -61,8 +60,4 @@
</plugins> </plugins>
</build> </build>
<properties>
<r2dbc-h2.version>0.8.1.RELEASE</r2dbc-h2.version>
</properties>
</project> </project>

View File

@ -11,4 +11,5 @@ logging.level.org.hibernate.SQL=INFO
logging.level.org.hibernate.type=INFO logging.level.org.hibernate.type=INFO
spring.jpa.properties.hibernate.validator.apply_to_ddl=false spring.jpa.properties.hibernate.validator.apply_to_ddl=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=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 spring.jpa.open-in-view=false

View File

@ -11,4 +11,5 @@ logging.level.org.hibernate.SQL=INFO
logging.level.org.hibernate.type=INFO logging.level.org.hibernate.type=INFO
spring.jpa.properties.hibernate.validator.apply_to_ddl=false spring.jpa.properties.hibernate.validator.apply_to_ddl=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.open-in-view=false spring.jpa.open-in-view=false

View File

@ -8,3 +8,4 @@ spring.h2.console.enabled=true
spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.path=/h2-console spring.h2.console.path=/h2-console
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

View File

@ -7,6 +7,8 @@ spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=false spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=true spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.validator.apply_to_ddl=false 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.jpa.properties.hibernate.check_nullability=true
spring.h2.console.enabled=true spring.h2.console.enabled=true
spring.h2.console.path=/h2-console spring.h2.console.path=/h2-console

View File

@ -12,3 +12,6 @@ spring:
driverClassName: org.h2.Driver driverClassName: org.h2.Driver
jpa: jpa:
spring.jpa.database-platform: org.hibernate.dialect.H2Dialect spring.jpa.database-platform: org.hibernate.dialect.H2Dialect
properties:
hibernate:
globally_quoted_identifiers: true

View File

@ -1,5 +1,5 @@
INSERT INTO countries (id, name) VALUES (1, 'USA'); INSERT INTO "countries" VALUES (1, 'USA');
INSERT INTO countries (id, name) VALUES (2, 'France'); INSERT INTO "countries" VALUES (2, 'France');
INSERT INTO countries (id, name) VALUES (3, 'Brazil'); INSERT INTO "countries" VALUES (3, 'Brazil');
INSERT INTO countries (id, name) VALUES (4, 'Italy'); INSERT INTO "countries" VALUES (4, 'Italy');
INSERT INTO countries (id, name) VALUES (5, 'Canada'); INSERT INTO "countries" VALUES (5, 'Canada');

View File

@ -1,12 +1,12 @@
insert into USER values (101, 'user1', 'comment1'); insert into "user" values (101, 'user1', 'comment1');
insert into USER values (102, 'user2', 'comment2'); insert into "user" values (102, 'user2', 'comment2');
insert into USER values (103, 'user3', 'comment3'); insert into "user" values (103, 'user3', 'comment3');
insert into USER values (104, 'user4', 'comment4'); insert into "user" values (104, 'user4', 'comment4');
insert into USER values (105, 'user5', 'comment5'); insert into "user" values (105, 'user5', 'comment5');
insert into DOCUMENT values (1, 'doc1', 101); insert into "document" values (1, 'doc1', 101);
insert into DOCUMENT values (2, 'doc2', 101); insert into "document" values (2, 'doc2', 101);
insert into DOCUMENT values (3, 'doc3', 101); insert into "document" values (3, 'doc3', 101);
insert into DOCUMENT values (4, 'doc4', 101); insert into "document" values (4, 'doc4', 101);
insert into DOCUMENT values (5, 'doc5', 102); insert into "document" values (5, 'doc5', 102);
insert into DOCUMENT values (6, 'doc6', 102); insert into "document" values (6, 'doc6', 102);

View File

@ -32,13 +32,8 @@
<dependency> <dependency>
<groupId>de.flapdoodle.embed</groupId> <groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId> <artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>${embed.mongo.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<properties>
<embed.mongo.version>3.2.6</embed.mongo.version>
</properties>
</project> </project>

View File

@ -66,6 +66,7 @@ public class H2JpaConfig {
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql")); hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
return hibernateProperties; return hibernateProperties;
} }

View File

@ -9,3 +9,5 @@ spring.h2.console.enabled=true
# Uppercase Table Names # Uppercase Table Names
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
hibernate.globally_quoted_identifiers=true

View File

@ -22,7 +22,7 @@ public class SpringBootProfileIntegrationTest {
private GenericEntityRepository genericEntityRepository; private GenericEntityRepository genericEntityRepository;
@Test @Test
public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() { public void givenGenericEntityRepository_whenSaveAndRetrieveEntity_thenOK() {
GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test")); GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test"));
GenericEntity foundEntity = genericEntityRepository.findById(genericEntity.getId()).orElse(null); GenericEntity foundEntity = genericEntityRepository.findById(genericEntity.getId()).orElse(null);
assertNotNull(foundEntity); assertNotNull(foundEntity);

View File

@ -62,6 +62,7 @@ public class H2TestProfileJPAConfig {
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql")); hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", env.getProperty("hibernate.globally_quoted_identifiers"));
return hibernateProperties; return hibernateProperties;
} }

View File

@ -17,8 +17,10 @@ import com.baeldung.boot.repository.EmployeeRepository;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class) @SpringBootTest(classes = Application.class)
@SqlGroup({ @Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)), @SqlGroup({
@Sql("/import_employees.sql")}) @Sql(scripts = "/employees_schema.sql", config = @SqlConfig(transactionMode = TransactionMode.ISOLATED)),
@Sql("/import_employees.sql")}
)
public class SpringBootSqlGroupAnnotationIntegrationTest { public class SpringBootSqlGroupAnnotationIntegrationTest {
@Autowired @Autowired

View File

@ -19,6 +19,7 @@ hibernate.hbm2ddl.auto=create-drop
hibernate.cache.use_second_level_cache=true hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true hibernate.cache.use_query_cache=true
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory 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.jpa.properties.hibernate.hbm2ddl.import_files=import_books.sql
spring.sql.init.data-locations=import_*_users.sql spring.sql.init.data-locations=import_*_users.sql

View File

@ -1,3 +1,5 @@
insert into EMPLOYEES values(1, 'Harsha', 'Developer'); delete from "employees";
insert into EMPLOYEES values(2, 'John', 'Tester');
insert into EMPLOYEES values(3, 'Ram', 'Manager'); insert into "employees" values(1, 'Harsha', 'Developer');
insert into "employees" values(2, 'John', 'Tester');
insert into "employees" values(3, 'Ram', 'Manager');

View File

@ -1,2 +1,2 @@
insert into EMPLOYEES values(4, 'Eric', 'Senior Developer'); insert into "employees" values(4, 'Eric', 'Senior Developer');
insert into EMPLOYEES values(5, 'Vidhyaah', 'Senior Manager'); insert into "employees" values(5, 'Vidhyaah', 'Senior Manager');

View File

@ -1,5 +1,5 @@
create table person ( create table person (
id integer identity primary key, id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
first_name varchar(30), first_name varchar(30),
last_name varchar(30) last_name varchar(30)
); );

View File

@ -13,6 +13,6 @@ public interface CompanyRepository extends JpaRepository<Company, Integer> {
@Query("SELECT C FROM Company C WHERE C.contactPerson.firstName = ?1") @Query("SELECT C FROM Company C WHERE C.contactPerson.firstName = ?1")
List<Company> findByContactPersonFirstNameWithJPQL(String firstName); 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); List<Company> findByContactPersonFirstNameWithNativeQuery(String firstName);
} }

View File

@ -4,3 +4,5 @@ spring.jpa.properties.hibernate.jdbc.batch_size=4
spring.jpa.properties.hibernate.order_inserts=true spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true spring.jpa.properties.hibernate.order_updates=true
spring.jpa.properties.hibernate.generate_statistics=true spring.jpa.properties.hibernate.generate_statistics=true
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

View File

@ -0,0 +1 @@
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

View File

@ -97,6 +97,6 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
int deleteDeactivatedUsersWithNoModifyingAnnotation(); int deleteDeactivatedUsersWithNoModifyingAnnotation();
@Modifying(clearAutomatically = true, flushAutomatically = true) @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(); void addDeletedColumn();
} }

View File

@ -62,6 +62,7 @@ public class StudentJpaConfig {
hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql")); 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_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.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; return hibernateProperties;
} }

View File

@ -7,3 +7,5 @@ hibernate.hbm2ddl.auto=create
hibernate.cache.use_second_level_cache=false hibernate.cache.use_second_level_cache=false
hibernate.cache.use_query_cache=false hibernate.cache.use_query_cache=false
hibernate.globally_quoted_identifiers=true

View File

@ -175,7 +175,7 @@ public class PersistenceConfig {
hibernateProperties.setProperty("hibernate.show_sql", "true"); hibernateProperties.setProperty("hibernate.show_sql", "true");
// hibernateProperties.setProperty("hibernate.format_sql", "true"); // hibernateProperties.setProperty("hibernate.format_sql", "true");
// hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
// Envers properties // Envers properties
hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix"));

View File

@ -12,7 +12,7 @@
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property> <property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</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.UserEager" />
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetailEager" /> <mapping class="com.baeldung.hibernate.fetching.model.OrderDetailEager" />

View File

@ -11,6 +11,7 @@
<property name="hibernate.connection.password">iamtheking</property> <property name="hibernate.connection.password">iamtheking</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</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.UserLazy" />
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" /> <mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" />
</session-factory> </session-factory>

View File

@ -1,8 +1,8 @@
insert into Users(id, name, creation_date, last_login_date, active, age, email, status) insert into Users(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); 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) insert into Users(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); 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) insert into Users(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); values('Cindy', PARSEDATETIME('02/02/2019', 'dd/MM/yyyy'), PARSEDATETIME('02/02/2020', 'dd/MM/yyyy'), 1, 18, 'cindy@email.com', 0);

View File

@ -15,7 +15,7 @@ public class HibernateFetchingIntegrationTest {
// this loads sample data in the database // this loads sample data in the database
@Before @Before
public void addFecthingTestData() { public void addFetchingTestData() {
FetchingAppView fav = new FetchingAppView(); FetchingAppView fav = new FetchingAppView();
fav.createTestData(); fav.createTestData();
} }

View File

@ -12,6 +12,7 @@
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property> <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
<property name="hibernate.hbm2ddl.auto">update</property> <property name="hibernate.hbm2ddl.auto">update</property>
<property name="show_sql">false</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.UserEager" />
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" /> <mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" />

View File

@ -12,6 +12,7 @@
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property> <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
<property name="hibernate.hbm2ddl.auto">update</property> <property name="hibernate.hbm2ddl.auto">update</property>
<property name="show_sql">false</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.UserLazy" />
<mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" /> <mapping class="com.baeldung.hibernate.fetching.model.OrderDetail" />

View File

@ -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(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, 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(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, 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(3, PARSEDATETIME('15/12/2017', 'dd/MM/yyyy'), PARSEDATETIME('16:00', 'HH:mm'), PARSEDATETIME('01/12/2017 13:45', 'dd/MM/yyyy HH:mm'));

View File

@ -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") @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(); 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(); List<ICommentCount> countTotalCommentsByYearNative();
} }

View File

@ -1,2 +1,4 @@
spring.jpa.show-sql=false spring.jpa.show-sql=false
spring.jpa.defer-datasource-initialization=true spring.jpa.defer-datasource-initialization=true
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

View File

@ -1,13 +1,13 @@
INSERT INTO department (id, name) VALUES (1, 'Infra'); INSERT INTO "department" ("id", "name") VALUES (1, 'Infra');
INSERT INTO department (id, name) VALUES (2, 'Accounting'); INSERT INTO "department" ("id", "name") VALUES (2, 'Accounting');
INSERT INTO department (id, name) VALUES (3, 'Management'); 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 (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 (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 (3, 'Jane', '35', 2);
INSERT INTO phone (id, number, employee_id) VALUES (1, '111', 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 (2, '222', 1);
INSERT INTO phone (id, number, employee_id) VALUES (3, '333', 1); INSERT INTO "phone" ("id", "number", "employee_id") VALUES (3, '333', 1);
COMMIT; COMMIT;

View File

@ -1,7 +1,7 @@
INSERT INTO Item(id,name) VALUES (1,'Table'); INSERT INTO "item" ("id", "name") VALUES (1,'Table');
INSERT INTO Item(id,name) VALUES (2,'Bottle'); 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 (1,1,'Rigid');
INSERT INTO Characteristic(id,item_id,type) VALUES (2,1,'Big'); 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 (3,2,'Fragile');
INSERT INTO Characteristic(id,item_id,type) VALUES (4,2,'Small'); INSERT INTO "characteristic" ("id", "item_id", "type") VALUES (4,2,'Small');

View File

@ -1,7 +1,7 @@
INSERT INTO post (id, title, content) VALUES (1, 'Comment 1', 'Content 1'); 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 (2, 'Comment 2', 'Content 2');
INSERT INTO post (id, title, content) VALUES (3, 'Comment 3', 'Content 3'); 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 (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 (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 (3, 2018, true, 'Comment 3', 2);
INSERT INTO comment (id, year, approved, content, post_id) VALUES (4, 2017, false, 'Comment 4', 3); INSERT INTO "comment" ("id", "year", "approved", "content", "post_id") VALUES (4, 2017, false, 'Comment 4', 3);

View File

@ -1 +1 @@
DELETE FROM Movie; DELETE FROM "movie";

View File

@ -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(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(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(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(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(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(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(7, 'The Sun Is Also a Star', 'Ry Russo-Young', 'PG-13', 100);

18
pom.xml
View File

@ -410,7 +410,6 @@
<module>java-jdi</module> <module>java-jdi</module>
<module>java-rmi</module> <module>java-rmi</module>
<module>java-spi</module> <module>java-spi</module>
<module>java-vavr-stream</module>
<module>java-websocket</module> <module>java-websocket</module>
<module>javax-sound</module> <module>javax-sound</module>
<module>javaxval</module> <module>javaxval</module>
@ -488,6 +487,7 @@
<module>reactive-systems</module> <module>reactive-systems</module>
<module>security-modules</module> <module>security-modules</module>
<module>slack</module> <module>slack</module>
<module>vavr-modules</module>
<module>web-modules</module> <module>web-modules</module>
</modules> </modules>
@ -610,7 +610,6 @@
<module>spring-threads</module> <module>spring-threads</module>
<module>spring-vault</module> <module>spring-vault</module>
<module>spring-vertx</module>
<module>spring-web-modules</module> <module>spring-web-modules</module>
<module>spring-webflux-amqp</module> <!-- long --> <module>spring-webflux-amqp</module> <!-- long -->
@ -627,8 +626,7 @@
<module>undertow</module> <module>undertow</module>
<module>vertx</module> <module>vertx-modules</module>
<module>vertx-and-rxjava</module>
<module>video-tutorials</module> <module>video-tutorials</module>
<module>webrtc</module> <module>webrtc</module>
@ -692,8 +690,7 @@
<module>spring-ejb-modules/ejb-beans</module> <module>spring-ejb-modules/ejb-beans</module>
<module>vaadin</module> <module>vaadin</module>
<module>vavr</module> <module>vavr-modules</module>
<module>vavr-2</module>
</modules> </modules>
</profile> </profile>
@ -809,7 +806,6 @@
<module>java-jdi</module> <module>java-jdi</module>
<module>java-rmi</module> <module>java-rmi</module>
<module>java-spi</module> <module>java-spi</module>
<module>java-vavr-stream</module>
<module>java-websocket</module> <module>java-websocket</module>
<module>javax-sound</module> <module>javax-sound</module>
<module>javaxval</module> <module>javaxval</module>
@ -889,6 +885,7 @@
<module>reactive-systems</module> <module>reactive-systems</module>
<module>security-modules</module> <module>security-modules</module>
<module>slack</module> <module>slack</module>
<module>vavr-modules</module>
<module>web-modules</module> <module>web-modules</module>
</modules> </modules>
@ -1004,7 +1001,6 @@
<module>spring-threads</module> <module>spring-threads</module>
<module>spring-vault</module> <module>spring-vault</module>
<module>spring-vertx</module>
<module>spring-web-modules</module> <module>spring-web-modules</module>
<module>spring-webflux-amqp</module> <!-- long --> <module>spring-webflux-amqp</module> <!-- long -->
@ -1021,8 +1017,7 @@
<module>undertow</module> <module>undertow</module>
<module>vertx</module> <module>vertx-modules</module>
<module>vertx-and-rxjava</module>
<module>video-tutorials</module> <module>video-tutorials</module>
<module>webrtc</module> <module>webrtc</module>
@ -1079,8 +1074,7 @@
<module>spring-ejb-modules/ejb-beans</module> <module>spring-ejb-modules/ejb-beans</module>
<module>vaadin</module> <module>vaadin</module>
<module>vavr</module> <module>vavr-modules</module>
<module>vavr-2</module>
</modules> </modules>
</profile> </profile>

View File

@ -1,7 +1,7 @@
DROP TABLE coffee IF EXISTS; DROP TABLE coffee IF EXISTS;
CREATE TABLE coffee ( CREATE TABLE coffee (
coffee_id BIGINT IDENTITY NOT NULL PRIMARY KEY, coffee_id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
brand VARCHAR(20), brand VARCHAR(20),
origin VARCHAR(20), origin VARCHAR(20),
characteristics VARCHAR(30) characteristics VARCHAR(30)

View File

@ -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);
}
}

View File

@ -1,9 +1,12 @@
package com.baeldung.sprq; package com.baeldung.sprq;
import org.jobrunr.autoconfigure.JobRunrAutoConfiguration;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
@EnableAutoConfiguration(exclude = { JobRunrAutoConfiguration.class})
public class SpqrApp { public class SpqrApp {
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest(classes = OpenApiApplication.class)
@AutoConfigureMockMvc @AutoConfigureMockMvc
public class OpenApiPetsIntegrationTest { public class OpenApiPetsIntegrationTest {

View File

@ -122,7 +122,7 @@
</profiles> </profiles>
<properties> <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> <commons-configuration.version>1.10</commons-configuration.version>
<resource.delimiter>@</resource.delimiter> <resource.delimiter>@</resource.delimiter>
<!-- <start-class>com.baeldung.buildproperties.Application</start-class> --> <!-- <start-class>com.baeldung.buildproperties.Application</start-class> -->

View File

@ -71,7 +71,6 @@
<dependency> <dependency>
<groupId>javax.persistence</groupId> <groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId> <artifactId>javax.persistence-api</artifactId>
<version>${jpa.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
@ -87,15 +86,12 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<properties> <properties>
<jpa.version>2.2</jpa.version>
<subethasmtp.version>3.1.7</subethasmtp.version> <subethasmtp.version>3.1.7</subethasmtp.version>
<springcloud.version>3.1.0</springcloud.version> <springcloud.version>3.1.3</springcloud.version>
<httpclient.version>4.5.8</httpclient.version>
</properties> </properties>
</project> </project>

View File

@ -14,6 +14,9 @@ public class TestRedisConfiguration {
public TestRedisConfiguration(final RedisProperties redisProperties) { public TestRedisConfiguration(final RedisProperties redisProperties) {
this.redisServer = new RedisServer(redisProperties.getRedisPort()); this.redisServer = new RedisServer(redisProperties.getRedisPort());
//Uncomment below if running on windows and can't start redis server
// this.redisServer = RedisServer.builder().setting("maxheap 200m").port(6379).setting("bind localhost").build();
// redisServer.start();
} }
@PostConstruct @PostConstruct

3
vavr-modules/README.md Normal file
View File

@ -0,0 +1,3 @@
## VAVR
This module contains modules about vavr.

View File

@ -11,7 +11,7 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>vavr-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>

33
vavr-modules/pom.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>vavr-modules</artifactId>
<name>vavr-modules</name>
<packaging>pom</packaging>
<parent>
<artifactId>parent-modules</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>vavr</module>
<module>vavr-2</module>
<module>java-vavr-stream</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -8,11 +8,10 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<parent> <parent>
<artifactId>parent-modules</artifactId>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>vavr-modules</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>io.vavr</groupId> <groupId>io.vavr</groupId>

View File

@ -11,7 +11,7 @@
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId> <artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath> <relativePath>../../parent-boot-2</relativePath>
</parent> </parent>
<dependencies> <dependencies>

3
vertx-modules/README.md Normal file
View File

@ -0,0 +1,3 @@
## VERTX
This module contains modules about VERTX.

33
vertx-modules/pom.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>vertx-modules</artifactId>
<name>vertx-modules</name>
<packaging>pom</packaging>
<parent>
<artifactId>parent-modules</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>vertx</module>
<module>spring-vertx</module>
<module>vertx-and-rxjava</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -12,7 +12,7 @@
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId> <artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath> <relativePath>../../parent-boot-2</relativePath>
</parent> </parent>
<dependencies> <dependencies>

Some files were not shown because too many files have changed in this diff Show More