From da7a651ef41fadcc58ac42cfb877cbf827f96543 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:26:13 +0800 Subject: [PATCH 01/51] Create README.md --- .../src/main/java/com/baeldung/deserialization/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md new file mode 100644 index 0000000000..04b03e4907 --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [What is the serialVersionUID?](https://www.baeldung.com/java-serial-version-uid) From abae8ec0cfc5ad457dc13736a517be69f0803b99 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:28:02 +0800 Subject: [PATCH 02/51] Create README.md --- .../core-java/src/main/java/com/baeldung/uuid/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md new file mode 100644 index 0000000000..bc464a4a1d --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Guide to UUID in Java](https://www.baeldung.com/java-uuid) From 3974bf9dd7abb69983550a114994c4cf75a55179 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:29:43 +0800 Subject: [PATCH 03/51] Create README.md [skip ci] --- .../src/main/java/com/baeldung/serialization/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md new file mode 100644 index 0000000000..d9167fa3b8 --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Introduction to Java Serialization](https://www.baeldung.com/java-serialization) From f1e3f5bf07f72394b1ddd707f8bee595351d8d23 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:39:06 +0800 Subject: [PATCH 04/51] Create README.md [skip ci] --- .../core-java/src/main/java/com/baeldung/classloader/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md new file mode 100644 index 0000000000..e26a3e2de9 --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Class Loaders in Java](https://www.baeldung.com/java-classloaders) From a23ec1d573a8d16e508400c23b06512e38c0a095 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:40:00 +0800 Subject: [PATCH 05/51] Create README.md [skip ci] --- .../core-java/src/main/java/com/baeldung/console/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/console/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/console/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/console/README.md new file mode 100644 index 0000000000..418892f288 --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/console/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Console I/O in Java](https://www.baeldung.com/java-console-input-output) From ec136b7e7123d303840325fd4bc8f4489755b491 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:40:54 +0800 Subject: [PATCH 06/51] Create README.md [skip ci] --- .../src/main/java/com/baeldung/abstractclasses/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md new file mode 100644 index 0000000000..8ded91b275 --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class/) From ab89eeb9a4781dac4c6086c94b42bb9007cdc4de Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:42:50 +0800 Subject: [PATCH 07/51] Create README.md [skip ci] --- core-java-modules/core-java-lambdas/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java-lambdas/README.md diff --git a/core-java-modules/core-java-lambdas/README.md b/core-java-modules/core-java-lambdas/README.md new file mode 100644 index 0000000000..10b876735e --- /dev/null +++ b/core-java-modules/core-java-lambdas/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Why Do Local Variables Used in Lambdas Have to Be Final or Effectively Final?](https://www.baeldung.com/java-lambda-effectively-final-local-variables) From d0ed8bd21b97fa8cb99c8b18a9cd037e9fe5654c Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:48:53 +0800 Subject: [PATCH 08/51] Create README.md [skip ci] --- maven/profiles/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 maven/profiles/README.md diff --git a/maven/profiles/README.md b/maven/profiles/README.md new file mode 100644 index 0000000000..84b0a81ceb --- /dev/null +++ b/maven/profiles/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Guide to Maven Profiles](https://www.baeldung.com/maven-profiles) From 085258d234c74a3e359b28e41c401f7f37f5238d Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:50:24 +0800 Subject: [PATCH 09/51] Update README.md [skip ci] --- persistence-modules/spring-data-jpa-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-data-jpa-2/README.md b/persistence-modules/spring-data-jpa-2/README.md index 393d15d6f1..d35c05851b 100644 --- a/persistence-modules/spring-data-jpa-2/README.md +++ b/persistence-modules/spring-data-jpa-2/README.md @@ -12,3 +12,4 @@ - [Spring Data JPA Projections](https://www.baeldung.com/spring-data-jpa-projections) - [JPA @Embedded And @Embeddable](https://www.baeldung.com/jpa-embedded-embeddable) - [Spring Data JPA Delete and Relationships](https://www.baeldung.com/spring-data-jpa-delete) +- [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) From 75103d1dacc0cedb91dd184bf3f504c1415e5d70 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:50:57 +0800 Subject: [PATCH 10/51] Update README.md [skip ci] --- persistence-modules/spring-data-jpa-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-data-jpa-2/README.md b/persistence-modules/spring-data-jpa-2/README.md index d35c05851b..8893b09286 100644 --- a/persistence-modules/spring-data-jpa-2/README.md +++ b/persistence-modules/spring-data-jpa-2/README.md @@ -13,3 +13,4 @@ - [JPA @Embedded And @Embeddable](https://www.baeldung.com/jpa-embedded-embeddable) - [Spring Data JPA Delete and Relationships](https://www.baeldung.com/spring-data-jpa-delete) - [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) +- [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junits-filtering-tests) From 50d6f0b8395c73fd7c5190cccef75700ac9fb39c Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:52:02 +0800 Subject: [PATCH 11/51] Update README.md [skip ci] --- persistence-modules/java-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 34d03b3259..0426015045 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -8,3 +8,4 @@ - [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date) - [Combining JPA And/Or Criteria Predicates](https://www.baeldung.com/jpa-and-or-criteria-predicates) - [Types of JPA Queries](https://www.baeldung.com/jpa-queries) +- [Defining JPA Entities](https://www.baeldung.com/jpa-entities) From 0e01973ff661081a6a5fc02349dcd34f1454a45a Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:53:15 +0800 Subject: [PATCH 12/51] Create README.md [skip ci] --- quarkus/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 quarkus/README.md diff --git a/quarkus/README.md b/quarkus/README.md new file mode 100644 index 0000000000..01009eab3e --- /dev/null +++ b/quarkus/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [Guide to QuarkusIO](hhttps://www.baeldung.com/quarkus-io) From 384fe96e49c860500d3c473879d6379b282f7177 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:54:26 +0800 Subject: [PATCH 13/51] Update README.md [skip ci] --- persistence-modules/spring-data-jpa-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-data-jpa-2/README.md b/persistence-modules/spring-data-jpa-2/README.md index 8893b09286..78a228986a 100644 --- a/persistence-modules/spring-data-jpa-2/README.md +++ b/persistence-modules/spring-data-jpa-2/README.md @@ -14,3 +14,4 @@ - [Spring Data JPA Delete and Relationships](https://www.baeldung.com/spring-data-jpa-delete) - [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) - [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junits-filtering-tests) +- [Batch Insert/Update with Hibernate/JPA](https://www.baeldung.com/jpa-hibernate-batch-insert-update) From 25f7fe72c537bf2cd2ab9bdc996cdb182a15dc68 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:55:32 +0800 Subject: [PATCH 14/51] Create README.md [skip ci] --- apache-olingo/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 apache-olingo/README.md diff --git a/apache-olingo/README.md b/apache-olingo/README.md new file mode 100644 index 0000000000..bfbdc97700 --- /dev/null +++ b/apache-olingo/README.md @@ -0,0 +1,3 @@ +## Relevant articles: + +- [OData Protocol Guide](https://www.baeldung.com/odata) From e6c5d0024a15bc64ce0a4b733924a7e831c972b1 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:56:51 +0800 Subject: [PATCH 15/51] Update README.md [skip ci] --- persistence-modules/java-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 0426015045..33d31781e0 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -9,3 +9,4 @@ - [Combining JPA And/Or Criteria Predicates](https://www.baeldung.com/jpa-and-or-criteria-predicates) - [Types of JPA Queries](https://www.baeldung.com/jpa-queries) - [Defining JPA Entities](https://www.baeldung.com/jpa-entities) +- [JPA @Basic Annotation](https://www.baeldung.com/jpa-basic-annotation) From 76c498f670fe2c7e2694cab33eaff4d865182104 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 16:57:44 +0800 Subject: [PATCH 16/51] Update README.md [skip ci] --- persistence-modules/java-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 33d31781e0..ca9ec0d74d 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -10,3 +10,4 @@ - [Types of JPA Queries](https://www.baeldung.com/jpa-queries) - [Defining JPA Entities](https://www.baeldung.com/jpa-entities) - [JPA @Basic Annotation](https://www.baeldung.com/jpa-basic-annotation) +- [Default Column Values in JPA](https://www.baeldung.com/jpa-default-column-values) From 3e14bc38a016ffd710c1ae9fff970eaeac72adb4 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 17:01:36 +0800 Subject: [PATCH 17/51] Update README.md [skip ci] --- testing-modules/junit-5/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index 47db6587b4..d687b35cac 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -1,6 +1,5 @@ ### Relevant Articles: -- [The Basics of JUnit 5 – A Preview](http://www.baeldung.com/junit-5-preview) -- [A Guide to JUnit 5](http://www.baeldung.com/junit-5) +- [A Guide to JUnit 5](http://www.baeldung.com/junit-5-preview) - [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) - [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) - [A Guide to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) From 58538e329a10fb48238790649d997aedbfbfb338 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 17:03:14 +0800 Subject: [PATCH 18/51] Update README.md [skip ci] --- persistence-modules/spring-persistence-simple/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index c408ff3c96..12b7d025a9 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -6,7 +6,7 @@ ### Relevant Articles: - [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) - [Bootstrapping Hibernate 5 with Spring](http://www.baeldung.com/hibernate-5-spring) -- [The DAO with Spring and Hibernate](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) +- [Simplify the DAO with Spring and Java Generics](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) - [DAO with Spring and Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) - [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) - [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) From 92ec5af77c88e0218c13132e9a96a80e413503d3 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 17:03:39 +0800 Subject: [PATCH 19/51] Update README.md [skip ci] --- persistence-modules/spring-persistence-simple/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index 12b7d025a9..ed81c9c564 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -9,7 +9,7 @@ - [Simplify the DAO with Spring and Java Generics](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) - [DAO with Spring and Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) - [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) -- [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) +- [A Guide to JPA with Spring](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) - [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) - [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) From 287f589aeee4c26ba7064ea29e2bc52eddd1d62c Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 17:04:25 +0800 Subject: [PATCH 20/51] Update README.md [skip ci] --- core-java-modules/core-java-9/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-9/README.md b/core-java-modules/core-java-9/README.md index 5715520bae..8b52ce79b4 100644 --- a/core-java-modules/core-java-9/README.md +++ b/core-java-modules/core-java-9/README.md @@ -28,6 +28,6 @@ - [Java 9 Convenience Factory Methods for Collections](https://www.baeldung.com/java-9-collections-factory-methods) - [Java 9 Stream API Improvements](https://www.baeldung.com/java-9-stream-api) - [A Guide to Java 9 Modularity](https://www.baeldung.com/java-9-modularity) -- [Java 9 Platform Module API](https://www.baeldung.com/java-9-module-api) +- [Java 9 java.lang.Module API](https://www.baeldung.com/java-9-module-api) - [Java 9 Platform Logging API](https://www.baeldung.com/java-9-logging-api) - [Filtering a Stream of Optionals in Java](https://www.baeldung.com/java-filter-stream-of-optional) From 6072ddee005f6ce09e225de96037c32ff09ef92a Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 17:05:20 +0800 Subject: [PATCH 21/51] Update README.md [skip ci] --- persistence-modules/java-jpa/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index ca9ec0d74d..ae72e6b3c8 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -2,7 +2,7 @@ - [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) - [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) -- [Fixing the JPA error “java.lang.String cannot be cast to Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) +- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) - [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) - [JPA 2.2 Support for Java 8 Date/Time Types](https://www.baeldung.com/jpa-java-time) - [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date) From 47456f147da7814c161c4dae50b43702d76ea92b Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 17:05:43 +0800 Subject: [PATCH 22/51] Update README.md [skip ci] --- persistence-modules/java-jpa/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index ae72e6b3c8..554e10dc98 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -2,7 +2,7 @@ - [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) - [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) -- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) +- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”]](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) - [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) - [JPA 2.2 Support for Java 8 Date/Time Types](https://www.baeldung.com/jpa-java-time) - [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date) From 027b6b884021736acc8234872fb78afe62387f5b Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 17:53:15 +0800 Subject: [PATCH 23/51] Delete README.md --- .../src/main/java/com/baeldung/deserialization/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md deleted file mode 100644 index 04b03e4907..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/deserialization/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [What is the serialVersionUID?](https://www.baeldung.com/java-serial-version-uid) From 78ae20dc0e1602daf0699cabb8feb58aa9f151a3 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 18:12:37 +0800 Subject: [PATCH 24/51] Delete README.md --- .../core-java/src/main/java/com/baeldung/uuid/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md deleted file mode 100644 index bc464a4a1d..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/uuid/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Guide to UUID in Java](https://www.baeldung.com/java-uuid) From d7e2d7f59fe5908c5cb2cb74037341ba2ffac469 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 18:13:41 +0800 Subject: [PATCH 25/51] Delete README.md --- testing-modules/junit-5/README.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 testing-modules/junit-5/README.md diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md deleted file mode 100644 index d687b35cac..0000000000 --- a/testing-modules/junit-5/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### Relevant Articles: -- [A Guide to JUnit 5](http://www.baeldung.com/junit-5-preview) -- [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) -- [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) -- [A Guide to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) -- [Inject Parameters into JUnit Jupiter Unit Tests](http://www.baeldung.com/junit-5-parameters) -- [Mockito and JUnit 5 – Using ExtendWith](http://www.baeldung.com/mockito-junit-5-extension) -- [JUnit5 @RunWith](http://www.baeldung.com/junit-5-runwith) -- [JUnit 5 @Test Annotation](http://www.baeldung.com/junit-5-test-annotation) -- [Assert an Exception is Thrown in JUnit 4 and 5](http://www.baeldung.com/junit-assert-exception) -- [@Before vs @BeforeClass vs @BeforeEach vs @BeforeAll](http://www.baeldung.com/junit-before-beforeclass-beforeeach-beforeall) -- [Migrating from JUnit 4 to JUnit 5](http://www.baeldung.com/junit-5-migration) -- [JUnit5 Programmatic Extension Registration with @RegisterExtension](http://www.baeldung.com/junit-5-registerextension-annotation) -- [The Order of Tests in JUnit](http://www.baeldung.com/junit-5-test-order) -- [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java) -- [Testing an Abstract Class With JUnit](https://www.baeldung.com/junit-test-abstract-class) -- [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) -- [Guide to JUnit 5 Parameterized Tests](https://www.baeldung.com/parameterized-tests-junit-5) -- [JUnit 5 Conditional Test Execution with Annotations](https://www.baeldung.com/junit-5-conditional-test-execution) From 8ff0bed3a49ce9fb9bd76f5a1831c5a21e74c5b4 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Fri, 24 May 2019 18:14:54 +0800 Subject: [PATCH 26/51] Delete README.md --- .../src/main/java/com/baeldung/serialization/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md deleted file mode 100644 index d9167fa3b8..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/serialization/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Introduction to Java Serialization](https://www.baeldung.com/java-serialization) From 8ac77800a0a6a3f1e114fab18d7a721949302780 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sun, 26 May 2019 19:38:40 +0300 Subject: [PATCH 27/51] fix remove vertex --- .../main/java/com/baeldung/graph/Graph.java | 2 +- ...versalUnitTest.java => GraphUnitTest.java} | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) rename core-java-modules/core-java/src/test/java/com/baeldung/graph/{GraphTraversalUnitTest.java => GraphUnitTest.java} (61%) diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/graph/Graph.java b/core-java-modules/core-java/src/main/java/com/baeldung/graph/Graph.java index 3f2e17c43c..58713b1b3f 100644 --- a/core-java-modules/core-java/src/main/java/com/baeldung/graph/Graph.java +++ b/core-java-modules/core-java/src/main/java/com/baeldung/graph/Graph.java @@ -19,7 +19,7 @@ public class Graph { void removeVertex(String label) { Vertex v = new Vertex(label); - adjVertices.values().stream().map(e -> e.remove(v)).collect(Collectors.toList()); + adjVertices.values().stream().forEach(e -> e.remove(v)); adjVertices.remove(new Vertex(label)); } diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/graph/GraphTraversalUnitTest.java b/core-java-modules/core-java/src/test/java/com/baeldung/graph/GraphUnitTest.java similarity index 61% rename from core-java-modules/core-java/src/test/java/com/baeldung/graph/GraphTraversalUnitTest.java rename to core-java-modules/core-java/src/test/java/com/baeldung/graph/GraphUnitTest.java index d955d56d95..68611e508b 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/graph/GraphTraversalUnitTest.java +++ b/core-java-modules/core-java/src/test/java/com/baeldung/graph/GraphUnitTest.java @@ -1,20 +1,31 @@ package com.baeldung.graph; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; import org.junit.Test; -public class GraphTraversalUnitTest { +public class GraphUnitTest { @Test public void givenAGraph_whenTraversingDepthFirst_thenExpectedResult() { Graph graph = createGraph(); - Assert.assertEquals("[Bob, Rob, Maria, Alice, Mark]", + assertEquals("[Bob, Rob, Maria, Alice, Mark]", GraphTraversal.depthFirstTraversal(graph, "Bob").toString()); } @Test public void givenAGraph_whenTraversingBreadthFirst_thenExpectedResult() { Graph graph = createGraph(); - Assert.assertEquals("[Bob, Alice, Rob, Mark, Maria]", + assertEquals("[Bob, Alice, Rob, Mark, Maria]", + GraphTraversal.breadthFirstTraversal(graph, "Bob").toString()); + } + + @Test + public void givenAGraph_whenRemoveVertex_thenVertedNotFound() { + Graph graph = createGraph(); + assertEquals("[Bob, Alice, Rob, Mark, Maria]", + GraphTraversal.breadthFirstTraversal(graph, "Bob").toString()); + + graph.removeVertex("Maria"); + assertEquals("[Bob, Alice, Rob, Mark]", GraphTraversal.breadthFirstTraversal(graph, "Bob").toString()); } From 0c1da760a6739d2f5a2e38e2eea77e3ebb286d14 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sun, 26 May 2019 21:37:30 +0200 Subject: [PATCH 28/51] geospatial mongoldb examples --- .../geo/MongoGeospatialIntegrationTest.java | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialIntegrationTest.java diff --git a/persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialIntegrationTest.java b/persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialIntegrationTest.java new file mode 100644 index 0000000000..77cbe02e7f --- /dev/null +++ b/persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialIntegrationTest.java @@ -0,0 +1,110 @@ +package com.baeldung.geo; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bson.Document; +import org.junit.Before; +import org.junit.Test; + +import com.mongodb.MongoClient; +import com.mongodb.client.FindIterable; +import com.mongodb.client.MongoCollection; +import com.mongodb.client.MongoDatabase; +import com.mongodb.client.model.Filters; +import com.mongodb.client.model.Indexes; +import com.mongodb.client.model.geojson.Point; +import com.mongodb.client.model.geojson.Polygon; +import com.mongodb.client.model.geojson.Position; + +public class MongoGeospatialIntegrationTest { + + private MongoClient mongoClient; + private MongoDatabase db; + private MongoCollection collection; + + @Before + public void setup() { + if (mongoClient == null) { + mongoClient = new MongoClient(); + db = mongoClient.getDatabase("myMongoDb"); + collection = db.getCollection("places"); + collection.deleteMany(new Document()); + collection.createIndex(Indexes.geo2dsphere("location")); + collection.insertOne(Document.parse("{'name':'Big Ben','location': {'coordinates':[-0.1268194,51.5007292],'type':'Point'}}")); + collection.insertOne(Document.parse("{'name':'Hyde Park','location': {'coordinates': [[[-0.159381,51.513126],[-0.189615,51.509928],[-0.187373,51.502442], [-0.153019,51.503464],[-0.159381,51.513126]]],'type':'Polygon'}}")); + } + } + + @Test + public void givenNearbyLocation_whenSearchNearby_thenFound() { + Point currentLoc = new Point(new Position(-0.126821, 51.495885)); + FindIterable result = collection.find(Filters.near("location", currentLoc, 1000.0, 10.0)); + + assertNotNull(result.first()); + assertEquals("Big Ben", result.first().get("name")); + } + + @Test + public void givenFarLocation_whenSearchNearby_thenNotFound() { + Point currentLoc = new Point(new Position(-0.5243333, 51.4700223)); + FindIterable result = collection.find(Filters.near("location", currentLoc, 5000.0, 10.0)); + + assertNull(result.first()); + } + + @Test + public void givenNearbyLocation_whenSearchWithinCircleSphere_thenFound() { + double distanceInRad = 5.0 / 6371; + FindIterable result = collection.find(Filters.geoWithinCenterSphere("location", -0.1435083, 51.4990956, distanceInRad)); + + assertNotNull(result.first()); + assertEquals("Big Ben", result.first().get("name")); + } + + @Test + public void givenNearbyLocation_whenSearchWithinBox_thenFound() { + double lowerLeftX = -0.1427638; + double lowerLeftY = 51.4991288; + double upperRightX = -0.1256209; + double upperRightY = 51.5030272; + + FindIterable result = collection.find(Filters.geoWithinBox("location", lowerLeftX, lowerLeftY, upperRightX, upperRightY)); + + assertNotNull(result.first()); + assertEquals("Big Ben", result.first().get("name")); + } + + @Test + public void givenNearbyLocation_whenSearchWithinPolygon_thenFound() { + ArrayList> points = new ArrayList>(); + points.add(Arrays.asList(-0.1439, 51.4952)); // victoria station + points.add(Arrays.asList(-0.1121, 51.4989));// Lambeth North + points.add(Arrays.asList(-0.13, 51.5163));// Tottenham Court Road + points.add(Arrays.asList(-0.1439, 51.4952)); // victoria station + FindIterable result = collection.find(Filters.geoWithinPolygon("location", points)); + + assertNotNull(result.first()); + assertEquals("Big Ben", result.first().get("name")); + } + + @Test + public void givenNearbyLocation_whenSearchUsingIntersect_thenFound() { + ArrayList positions = new ArrayList(); + positions.add(new Position(-0.1439, 51.4952)); + positions.add(new Position(-0.1346, 51.4978)); + positions.add(new Position(-0.2177, 51.5135)); + positions.add(new Position(-0.1439, 51.4952)); + Polygon geometry = new Polygon(positions); + FindIterable result = collection.find(Filters.geoIntersects("location", geometry)); + + assertNotNull(result.first()); + assertEquals("Hyde Park", result.first().get("name")); + } + +} From 60d26bfd0988d13bfa764015464620a95df8a59d Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:16:09 +0800 Subject: [PATCH 29/51] Delete README.md --- core-java-modules/core-java/src/main/java/com/baeldung/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/README.md deleted file mode 100644 index 7d843af9ea..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/README.md +++ /dev/null @@ -1 +0,0 @@ -### Relevant Articles: From f6b9546f75f4f756900feadd1d8534dc1170e9c8 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:17:22 +0800 Subject: [PATCH 30/51] Delete README.md --- .../core-java/src/main/java/com/baeldung/console/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/console/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/console/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/console/README.md deleted file mode 100644 index 418892f288..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/console/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Console I/O in Java](https://www.baeldung.com/java-console-input-output) From 8a71e4d4375d7e70ee9f8acb85ba82b251f882af Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:17:47 +0800 Subject: [PATCH 31/51] Delete README.md --- .../src/main/java/com/baeldung/abstractclasses/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md deleted file mode 100644 index 8ded91b275..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/abstractclasses/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class/) From e5d4480c49288a934972e5b46755e34a9cc19230 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:19:02 +0800 Subject: [PATCH 32/51] Delete README.md --- maven/profiles/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 maven/profiles/README.md diff --git a/maven/profiles/README.md b/maven/profiles/README.md deleted file mode 100644 index 84b0a81ceb..0000000000 --- a/maven/profiles/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Guide to Maven Profiles](https://www.baeldung.com/maven-profiles) From 6a192689cbe232ad33f517554ef4daa2b1ce4c23 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:19:26 +0800 Subject: [PATCH 33/51] Update README.md --- maven/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/maven/README.md b/maven/README.md index ca648ec203..6d1a7081b7 100644 --- a/maven/README.md +++ b/maven/README.md @@ -16,3 +16,4 @@ - [Multi-Module Project with Maven](https://www.baeldung.com/maven-multi-module) - [Maven Enforcer Plugin](https://www.baeldung.com/maven-enforcer-plugin) - [Eclipse Error: web.xml is missing and failOnMissingWebXml is set to true](https://www.baeldung.com/eclipse-error-web-xml-missing) +- [Guide to Maven Profiles](https://www.baeldung.com/maven-profiles) From ab7d29dbb3ab248456c7417be888775a9a73dcdb Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:37:51 +0800 Subject: [PATCH 34/51] Create README.md --- testing-modules/junit-5/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 testing-modules/junit-5/README.md diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md new file mode 100644 index 0000000000..fe8421f60a --- /dev/null +++ b/testing-modules/junit-5/README.md @@ -0,0 +1,21 @@ +### Relevant Articles: +- [The Basics of JUnit 5 – A Preview](http://www.baeldung.com/junit-5-preview) +- [A Guide to JUnit 5](http://www.baeldung.com/junit-5) +- [A Guide to JUnit 5](http://www.baeldung.com/junit-5-preview) +- [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) +- [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) +- [A Guide to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) +- [Inject Parameters into JUnit Jupiter Unit Tests](http://www.baeldung.com/junit-5-parameters) +- [Mockito and JUnit 5 – Using ExtendWith](http://www.baeldung.com/mockito-junit-5-extension) +- [JUnit5 @RunWith](http://www.baeldung.com/junit-5-runwith) +- [JUnit 5 @Test Annotation](http://www.baeldung.com/junit-5-test-annotation) +- [Assert an Exception is Thrown in JUnit 4 and 5](http://www.baeldung.com/junit-assert-exception) +- [@Before vs @BeforeClass vs @BeforeEach vs @BeforeAll](http://www.baeldung.com/junit-before-beforeclass-beforeeach-beforeall) +- [Migrating from JUnit 4 to JUnit 5](http://www.baeldung.com/junit-5-migration) +- [JUnit5 Programmatic Extension Registration with @RegisterExtension](http://www.baeldung.com/junit-5-registerextension-annotation) +- [The Order of Tests in JUnit](http://www.baeldung.com/junit-5-test-order) +- [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java) +- [Testing an Abstract Class With JUnit](https://www.baeldung.com/junit-test-abstract-class) +- [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) +- [Guide to JUnit 5 Parameterized Tests](https://www.baeldung.com/parameterized-tests-junit-5) +- [JUnit 5 Conditional Test Execution with Annotations](https://www.baeldung.com/junit-5-conditional-test-execution) From 82848b7911dab96440d5412b23a7ccc766a17aa6 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:40:32 +0800 Subject: [PATCH 35/51] Update README.md --- persistence-modules/spring-persistence-simple/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index ed81c9c564..ac97ef87c0 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -6,8 +6,8 @@ ### Relevant Articles: - [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) - [Bootstrapping Hibernate 5 with Spring](http://www.baeldung.com/hibernate-5-spring) -- [Simplify the DAO with Spring and Java Generics](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) -- [DAO with Spring and Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) +- [The DAO with Spring and Hibernate](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) +- [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) - [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) - [A Guide to JPA with Spring](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) - [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) From bf56719c05b6c2a6b69cbc7697d0e18462ecedea Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:42:42 +0800 Subject: [PATCH 36/51] Update README.md --- persistence-modules/spring-persistence-simple/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index ac97ef87c0..ff167b8cd0 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -9,10 +9,10 @@ - [The DAO with Spring and Hibernate](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) - [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) - [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) -- [A Guide to JPA with Spring](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) +- [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) - [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) - [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) - +- [Introduction to Spring Data JPA](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From 02c3405ddeac1cfd84aa65eb49fb445384d8ac34 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Mon, 27 May 2019 14:44:29 +0800 Subject: [PATCH 37/51] Update README.md --- persistence-modules/java-jpa/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 554e10dc98..ae72e6b3c8 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -2,7 +2,7 @@ - [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) - [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) -- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”]](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) +- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) - [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) - [JPA 2.2 Support for Java 8 Date/Time Types](https://www.baeldung.com/jpa-java-time) - [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date) From 41eb61026bfab292ced376239e039d111de3efe0 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Mon, 27 May 2019 14:49:42 +0300 Subject: [PATCH 38/51] fix kotlin import (#7028) --- .../com/baeldung/jvmannotations/Document.kt | 16 ---------------- .../com/baeldung/jvmannotations/TextDocument.kt | 16 ++++++++++++++++ .../com/baeldung/jvmannotations/XmlDocument.kt | 5 +++++ .../kotlin/com/baeldung/range/DocumentTest.kt | 2 ++ 4 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt create mode 100644 core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt b/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt index f66f8fbae0..55f60bfa81 100644 --- a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt +++ b/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt @@ -9,19 +9,3 @@ interface Document { fun getType() = "document" } - -class TextDocument : Document { - override fun getType() = "text" - - fun transformList(list : List) : List { - return list.filter { n -> n.toInt() > 1 } - } - - fun transformListInverseWildcards(list : List<@JvmSuppressWildcards Number>) : List<@JvmWildcard Number> { - return list.filter { n -> n.toInt() > 1 } - } - - var list : List<@JvmWildcard Any> = ArrayList() -} - -class XmlDocument(d : Document) : Document by d diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt b/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt new file mode 100644 index 0000000000..41cb0df939 --- /dev/null +++ b/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt @@ -0,0 +1,16 @@ +package com.baeldung.jvmannotations + +import java.util.* +class TextDocument : Document { + override fun getType() = "text" + + fun transformList(list : List) : List { + return list.filter { n -> n.toInt() > 1 } + } + + fun transformListInverseWildcards(list : List<@JvmSuppressWildcards Number>) : List<@JvmWildcard Number> { + return list.filter { n -> n.toInt() > 1 } + } + + var list : List<@JvmWildcard Any> = ArrayList() +} diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt b/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt new file mode 100644 index 0000000000..00f2582d5f --- /dev/null +++ b/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt @@ -0,0 +1,5 @@ +package com.baeldung.jvmannotations + +import java.util.* + +class XmlDocument(d : Document) : Document by d diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt b/core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt index 449e009104..2ec5402e5a 100644 --- a/core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt +++ b/core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt @@ -3,6 +3,8 @@ package com.baeldung.range import org.junit.Test import kotlin.test.assertEquals +import com.baeldung.jvmannotations.*; + class DocumentTest { @Test From e4e4a2bfa77e2370c889f3d9e322b22fa1e72adb Mon Sep 17 00:00:00 2001 From: Rodrigo Graciano Date: Mon, 27 May 2019 13:22:51 -0400 Subject: [PATCH 39/51] BAEL-2936 --- .../java/com/baeldung/convertToMap/Book.java | 48 ++++++++++++++++++ .../baeldung/convertToMap/ConvertToMap.java | 34 +++++++++++++ .../convertToMap/ConvertToMapUnitTest.java | 50 +++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 java-collections-conversions/src/main/java/com/baeldung/convertToMap/Book.java create mode 100644 java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java create mode 100644 java-collections-conversions/src/test/java/com/baeldung/convertToMap/ConvertToMapUnitTest.java diff --git a/java-collections-conversions/src/main/java/com/baeldung/convertToMap/Book.java b/java-collections-conversions/src/main/java/com/baeldung/convertToMap/Book.java new file mode 100644 index 0000000000..847e0bd8cd --- /dev/null +++ b/java-collections-conversions/src/main/java/com/baeldung/convertToMap/Book.java @@ -0,0 +1,48 @@ +package com.baeldung.convertToMap; + +public class Book { + private String name; + private int releaseYear; + private String isbn; + + + @Override + public String toString() { + return "Book{" + + "name='" + name + '\'' + + ", releaseYear=" + releaseYear + + ", isbn='" + isbn + '\'' + + '}'; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getReleaseYear() { + return releaseYear; + } + + public void setReleaseYear(int releaseYear) { + this.releaseYear = releaseYear; + } + + public String getIsbn() { + return isbn; + } + + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + public Book(String name, int releaseYear, String isbn) { + this.name = name; + this.releaseYear = releaseYear; + this.isbn = isbn; + } +} + diff --git a/java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java b/java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java new file mode 100644 index 0000000000..3c14dfdba6 --- /dev/null +++ b/java-collections-conversions/src/main/java/com/baeldung/convertToMap/ConvertToMap.java @@ -0,0 +1,34 @@ +package com.baeldung.convertToMap; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class ConvertToMap { + public Map listToMap(List books) { + return books.stream().collect(Collectors.toMap(Book::getIsbn, Book::getName)); + } + + public Map listToMapWithDupKeyError(List books) { + return books.stream().collect(Collectors.toMap(Book::getReleaseYear, Function.identity())); + } + + public Map listToMapWithDupKey(List books) { + return books.stream().collect(Collectors.toMap(Book::getReleaseYear, Function.identity(), + (o1, o2) -> o1)); + } + + public Map listToConcurrentMap(List books) { + return books.stream().collect(Collectors.toMap(Book::getReleaseYear, Function.identity(), (o1, o2) -> o1, ConcurrentHashMap::new)); + } + + public TreeMap listToSortedMap(List books) { + return books.stream() + .sorted(Comparator.comparing(Book::getName)) + .collect(Collectors.toMap(Book::getName, Function.identity(), (o1, o2) -> o1, TreeMap::new)); + } + + +} + diff --git a/java-collections-conversions/src/test/java/com/baeldung/convertToMap/ConvertToMapUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/convertToMap/ConvertToMapUnitTest.java new file mode 100644 index 0000000000..d11221bbf7 --- /dev/null +++ b/java-collections-conversions/src/test/java/com/baeldung/convertToMap/ConvertToMapUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.convertToMap; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; + + +public class ConvertToMapUnitTest { + + private List bookList; + private ConvertToMap convertToMap = new ConvertToMap(); + + @Before + public void init() { + bookList = new ArrayList<>(); + bookList.add(new Book("The Fellowship of the Ring", 1954, "0395489318")); + bookList.add(new Book("The Two Towers", 1954, "0345339711")); + bookList.add(new Book("The Return of the King", 1955, "0618129111")); + } + + @Test + public void whenConvertFromListToMap() { + assertTrue(convertToMap.listToMap(bookList).size() == 3); + } + + @Test(expected = IllegalStateException.class) + public void whenMapHasDuplicateKey_without_merge_function_then_runtime_exception() { + convertToMap.listToMapWithDupKeyError(bookList); + } + + @Test + public void whenMapHasDuplicateKey_with_merge_function() { + assertTrue(convertToMap.listToMapWithDupKey(bookList).size() == 2); + } + + @Test + public void whenCreateConcurrentHashMap() { + assertTrue(convertToMap.listToConcurrentMap(bookList) instanceof ConcurrentHashMap); + } + + @Test + public void whenMapisSorted() { + assertTrue(convertToMap.listToSortedMap(bookList).firstKey().equals("The Fellowship of the Ring")); + } +} From 5464a7935e5af02276b0a6ec25352001e3817160 Mon Sep 17 00:00:00 2001 From: DOHA Date: Mon, 27 May 2019 21:07:20 +0200 Subject: [PATCH 40/51] rename integration test to live test --- .../com/baeldung/{AppIntegrationTest.java => AppLiveTest.java} | 2 +- ...spatialIntegrationTest.java => MongoGeospatialLiveTest.java} | 2 +- .../{TaggingIntegrationTest.java => TaggingLiveTest.java} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename persistence-modules/java-mongodb/src/test/java/com/baeldung/{AppIntegrationTest.java => AppLiveTest.java} (98%) rename persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/{MongoGeospatialIntegrationTest.java => MongoGeospatialLiveTest.java} (98%) rename persistence-modules/java-mongodb/src/test/java/com/baeldung/tagging/{TaggingIntegrationTest.java => TaggingLiveTest.java} (99%) diff --git a/persistence-modules/java-mongodb/src/test/java/com/baeldung/AppIntegrationTest.java b/persistence-modules/java-mongodb/src/test/java/com/baeldung/AppLiveTest.java similarity index 98% rename from persistence-modules/java-mongodb/src/test/java/com/baeldung/AppIntegrationTest.java rename to persistence-modules/java-mongodb/src/test/java/com/baeldung/AppLiveTest.java index 94d1a01492..7692a37d03 100644 --- a/persistence-modules/java-mongodb/src/test/java/com/baeldung/AppIntegrationTest.java +++ b/persistence-modules/java-mongodb/src/test/java/com/baeldung/AppLiveTest.java @@ -19,7 +19,7 @@ import de.flapdoodle.embedmongo.config.MongodConfig; import de.flapdoodle.embedmongo.distribution.Version; import de.flapdoodle.embedmongo.runtime.Network; -public class AppIntegrationTest { +public class AppLiveTest { private static final String DB_NAME = "myMongoDb"; private MongodExecutable mongodExe; diff --git a/persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialIntegrationTest.java b/persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialLiveTest.java similarity index 98% rename from persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialIntegrationTest.java rename to persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialLiveTest.java index 77cbe02e7f..6e5a56491b 100644 --- a/persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialIntegrationTest.java +++ b/persistence-modules/java-mongodb/src/test/java/com/baeldung/geo/MongoGeospatialLiveTest.java @@ -22,7 +22,7 @@ import com.mongodb.client.model.geojson.Point; import com.mongodb.client.model.geojson.Polygon; import com.mongodb.client.model.geojson.Position; -public class MongoGeospatialIntegrationTest { +public class MongoGeospatialLiveTest { private MongoClient mongoClient; private MongoDatabase db; diff --git a/persistence-modules/java-mongodb/src/test/java/com/baeldung/tagging/TaggingIntegrationTest.java b/persistence-modules/java-mongodb/src/test/java/com/baeldung/tagging/TaggingLiveTest.java similarity index 99% rename from persistence-modules/java-mongodb/src/test/java/com/baeldung/tagging/TaggingIntegrationTest.java rename to persistence-modules/java-mongodb/src/test/java/com/baeldung/tagging/TaggingLiveTest.java index ffb945e6d4..edd8e22775 100644 --- a/persistence-modules/java-mongodb/src/test/java/com/baeldung/tagging/TaggingIntegrationTest.java +++ b/persistence-modules/java-mongodb/src/test/java/com/baeldung/tagging/TaggingLiveTest.java @@ -16,7 +16,7 @@ import org.junit.Test; * @author Donato Rimenti * */ -public class TaggingIntegrationTest { +public class TaggingLiveTest { /** * Object to test. From f4b38eed2a3b37230e91d403b55880fc2e7e98d6 Mon Sep 17 00:00:00 2001 From: Vivek Date: Tue, 28 May 2019 04:47:58 +0530 Subject: [PATCH 41/51] BAEL-2901 Composite primary keys in JPA (#6994) * BAEL-2901 Composite primary keys in JPA * Formatted code using the recommended formatter.xml --- .../java/com/baeldung/jpa/entity/Account.java | 43 ++ .../com/baeldung/jpa/entity/AccountId.java | 52 +++ .../java/com/baeldung/jpa/entity/Book.java | 34 ++ .../java/com/baeldung/jpa/entity/BookId.java | 62 +++ .../main/resources/META-INF/persistence.xml | 377 ++++++++++-------- .../entity/CompositeKeysIntegrationTest.java | 114 ++++++ 6 files changed, 515 insertions(+), 167 deletions(-) create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Account.java create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/AccountId.java create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Book.java create mode 100644 persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/BookId.java create mode 100644 persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/entity/CompositeKeysIntegrationTest.java diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Account.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Account.java new file mode 100644 index 0000000000..48a98512fa --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Account.java @@ -0,0 +1,43 @@ +package com.baeldung.jpa.entity; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; + +@Entity +@IdClass(AccountId.class) +public class Account { + + @Id + private String accountNumber; + + @Id + private String accountType; + + private String description; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public String getAccountType() { + return accountType; + } + + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/AccountId.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/AccountId.java new file mode 100644 index 0000000000..091c326367 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/AccountId.java @@ -0,0 +1,52 @@ +package com.baeldung.jpa.entity; + +import java.io.Serializable; + +public class AccountId implements Serializable { + + private static final long serialVersionUID = 1L; + + private String accountNumber; + private String accountType; + + public AccountId() { + + } + + public AccountId(String accountNumber, String accountType) { + this.accountNumber = accountNumber; + this.accountType = accountType; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((accountNumber == null) ? 0 : accountNumber.hashCode()); + result = prime * result + ((accountType == null) ? 0 : accountType.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AccountId other = (AccountId) obj; + if (accountNumber == null) { + if (other.accountNumber != null) + return false; + } else if (!accountNumber.equals(other.accountNumber)) + return false; + if (accountType == null) { + if (other.accountType != null) + return false; + } else if (!accountType.equals(other.accountType)) + return false; + return true; + } + +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Book.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Book.java new file mode 100644 index 0000000000..460f302e28 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/Book.java @@ -0,0 +1,34 @@ +package com.baeldung.jpa.entity; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +@Entity +public class Book { + + @EmbeddedId + private BookId bookId; + + private String description; + + public Book() { + + } + + public Book(BookId bookId) { + this.bookId = bookId; + } + + public BookId getBookId() { + return bookId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/BookId.java b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/BookId.java new file mode 100644 index 0000000000..ff587beaf2 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/java/com/baeldung/jpa/entity/BookId.java @@ -0,0 +1,62 @@ +package com.baeldung.jpa.entity; + +import java.io.Serializable; + +import javax.persistence.Embeddable; + +@Embeddable +public class BookId implements Serializable { + + private static final long serialVersionUID = 1L; + private String title; + private String language; + + public BookId() { + + } + + public BookId(String title, String language) { + this.title = title; + this.language = language; + } + + public String getTitle() { + return title; + } + + public String getLanguage() { + return language; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((language == null) ? 0 : language.hashCode()); + result = prime * result + ((title == null) ? 0 : title.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BookId other = (BookId) obj; + if (language == null) { + if (other.language != null) + return false; + } else if (!language.equals(other.language)) + return false; + if (title == null) { + if (other.title != null) + return false; + } else if (!title.equals(other.title)) + return false; + return true; + } + +} diff --git a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml index 298397e39d..fc3ff05255 100644 --- a/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml @@ -1,183 +1,226 @@ + version="2.2"> - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.sqlresultsetmapping.ScheduledDay - com.baeldung.sqlresultsetmapping.Employee - true - - - - - - - - - - - + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.sqlresultsetmapping.ScheduledDay + com.baeldung.sqlresultsetmapping.Employee + true + + + + + + + + + + + - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.stringcast.Message - com.baeldung.jpa.enums.Article - com.baeldung.jpa.enums.CategoryConverter - true - - - - - - - - - - - + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.stringcast.Message + com.baeldung.jpa.enums.Article + com.baeldung.jpa.enums.CategoryConverter + true + + + + + + + + + + + - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.model.Car - true - - - - - - - - - + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.model.Car + true + + + + + + + + + - - com.baeldung.jpa.entitygraph.model.Post - com.baeldung.jpa.entitygraph.model.User - com.baeldung.jpa.entitygraph.model.Comment - true - + + com.baeldung.jpa.entitygraph.model.Post + com.baeldung.jpa.entitygraph.model.User + com.baeldung.jpa.entitygraph.model.Comment + true + - - - + + + - - - - + + + + - - org.eclipse.persistence.jpa.PersistenceProvider - com.baeldung.jpa.datetime.JPA22DateTimeEntity - true - - - - - - + + org.eclipse.persistence.jpa.PersistenceProvider + com.baeldung.jpa.datetime.JPA22DateTimeEntity + true + + + + + + - - - - - - + + + + + + - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.criteria.entity.Item - true - - - - - - - - - - - - + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.criteria.entity.Item + true + + + + + + + + + + + + - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.querytypes.UserEntity - true - - - - - - - - - - - - + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.querytypes.UserEntity + true + + + + + + + + + + + + - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.defaultvalues.User - true - - - - - - - - - - - - - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.entity.Student - true - - - - - - - - - - - + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.defaultvalues.User + true + + + + + + + + + + + - - org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.projections.Product - true - - - - - - - - - - - - + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.entity.Student + com.baeldung.jpa.entity.Book + com.baeldung.jpa.entity.BookId + com.baeldung.jpa.entity.Account + com.baeldung.jpa.entity.AccountId + true + + + + + + + + + + + + + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.projections.Product + true + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/entity/CompositeKeysIntegrationTest.java b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/entity/CompositeKeysIntegrationTest.java new file mode 100644 index 0000000000..2d30ebab5e --- /dev/null +++ b/persistence-modules/java-jpa/src/test/java/com/baeldung/jpa/entity/CompositeKeysIntegrationTest.java @@ -0,0 +1,114 @@ +package com.baeldung.jpa.entity; + +import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CompositeKeysIntegrationTest { + + private static final String SAVINGS_ACCOUNT = "Savings"; + private static final String ACCOUNT_NUMBER = "JXSDF324234"; + private static final String ENGLISH = "English"; + private static final String WAR_AND_PEACE = "War and Peace"; + + private static EntityManagerFactory emf; + private static EntityManager em; + + @BeforeClass + public static void setup() { + emf = Persistence.createEntityManagerFactory("jpa-entity-definition"); + em = emf.createEntityManager(); + } + + @Test + public void persistBookWithCompositeKeyThenRetrieveDetails() { + Book warAndPeace = createBook(); + persist(warAndPeace); + clearThePersistenceContext(); + Book book = findBookByBookId(); + verifyAssertionsWith(book); + } + + @Test + public void persistAccountWithCompositeKeyThenRetrieveDetails() { + Account savingsAccount = createAccount(); + persist(savingsAccount); + clearThePersistenceContext(); + Account account = findAccountByAccountId(); + verifyAssertionsWith(account); + } + + @AfterClass + public static void destroy() { + if (em != null) { + em.close(); + } + if (emf != null) { + emf.close(); + } + } + + private Account createAccount() { + Account savingsAccount = new Account(); + savingsAccount.setAccountNumber(ACCOUNT_NUMBER); + savingsAccount.setAccountType(SAVINGS_ACCOUNT); + savingsAccount.setDescription("Savings account"); + return savingsAccount; + } + + private void verifyAssertionsWith(Account account) { + assertEquals(ACCOUNT_NUMBER, account.getAccountNumber()); + assertEquals(SAVINGS_ACCOUNT, account.getAccountType()); + } + + private Account findAccountByAccountId() { + return em.find(Account.class, new AccountId(ACCOUNT_NUMBER, SAVINGS_ACCOUNT)); + } + + private void persist(Account account) { + em.getTransaction() + .begin(); + em.persist(account); + em.getTransaction() + .commit(); + } + + private Book findBookByBookId() { + return em.find(Book.class, new BookId(WAR_AND_PEACE, ENGLISH)); + } + + private Book createBook() { + BookId bookId = new BookId(WAR_AND_PEACE, ENGLISH); + Book warAndPeace = new Book(bookId); + warAndPeace.setDescription("Novel and Historical Fiction"); + return warAndPeace; + } + + private void verifyAssertionsWith(Book book) { + assertNotNull(book); + assertNotNull(book.getBookId()); + assertEquals(WAR_AND_PEACE, book.getBookId() + .getTitle()); + assertEquals(ENGLISH, book.getBookId() + .getLanguage()); + } + + private void persist(Book book) { + em.getTransaction() + .begin(); + em.persist(book); + em.getTransaction() + .commit(); + } + + private void clearThePersistenceContext() { + em.clear(); + } +} From 55eeb63c214932a7f5cce21e469545de301e2584 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 14:11:43 +0800 Subject: [PATCH 42/51] Update README.md --- testing-modules/junit-5/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index fe8421f60a..47db6587b4 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -1,7 +1,6 @@ ### Relevant Articles: - [The Basics of JUnit 5 – A Preview](http://www.baeldung.com/junit-5-preview) - [A Guide to JUnit 5](http://www.baeldung.com/junit-5) -- [A Guide to JUnit 5](http://www.baeldung.com/junit-5-preview) - [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) - [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) - [A Guide to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) From 8842149c0d661fc2c6990d8b6ce91e2ef85e403b Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 14:13:07 +0800 Subject: [PATCH 43/51] Update README.md --- persistence-modules/spring-persistence-simple/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index ff167b8cd0..8e55a59c7c 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -12,7 +12,6 @@ - [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) - [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) - [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) -- [Introduction to Spring Data JPA](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From bfa2cd4c0767b53c1ba5e89ba8f9a41bad2fe93d Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 18:19:19 +0800 Subject: [PATCH 44/51] Update README.md --- testing-modules/junit-5-basics/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/testing-modules/junit-5-basics/README.md b/testing-modules/junit-5-basics/README.md index 6e44a9c071..a00e2a3f4a 100644 --- a/testing-modules/junit-5-basics/README.md +++ b/testing-modules/junit-5-basics/README.md @@ -1,4 +1,3 @@ ### Relevant Articles: - [Get the Path of the /src/test/resources Directory in JUnit](https://www.baeldung.com/junit-src-test-resources-directory-path) -- [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junit-filtering-tests) From 996ae2d6bce0573ec1f91e4e88ad529286036e12 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 18:21:11 +0800 Subject: [PATCH 45/51] Update README.md --- persistence-modules/java-jpa/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index ae72e6b3c8..554e10dc98 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -2,7 +2,7 @@ - [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) - [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) -- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) +- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”]](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) - [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) - [JPA 2.2 Support for Java 8 Date/Time Types](https://www.baeldung.com/jpa-java-time) - [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date) From 6f708d4d8e420e90dd042c3ed2d44a3a15a3d376 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 18:57:28 +0800 Subject: [PATCH 46/51] Update README.md [skip ci] --- testing-modules/junit-5-basics/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/junit-5-basics/README.md b/testing-modules/junit-5-basics/README.md index a00e2a3f4a..6e44a9c071 100644 --- a/testing-modules/junit-5-basics/README.md +++ b/testing-modules/junit-5-basics/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Get the Path of the /src/test/resources Directory in JUnit](https://www.baeldung.com/junit-src-test-resources-directory-path) +- [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junit-filtering-tests) From 9175d63bc3203454c984dd472a5c5899926935bb Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 18:57:59 +0800 Subject: [PATCH 47/51] Update README.md [skip ci] --- persistence-modules/spring-data-jpa-2/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/spring-data-jpa-2/README.md b/persistence-modules/spring-data-jpa-2/README.md index 1db0d23396..6b73729f9a 100644 --- a/persistence-modules/spring-data-jpa-2/README.md +++ b/persistence-modules/spring-data-jpa-2/README.md @@ -13,6 +13,5 @@ - [JPA @Embedded And @Embeddable](https://www.baeldung.com/jpa-embedded-embeddable) - [Spring Data JPA Delete and Relationships](https://www.baeldung.com/spring-data-jpa-delete) - [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) -- [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junits-filtering-tests) - [Batch Insert/Update with Hibernate/JPA](https://www.baeldung.com/jpa-hibernate-batch-insert-update) - [Difference Between save() and saveAndFlush() in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-save-saveandflush) From c0cc96004d0dc3b6b885e60e215524a218d63ac5 Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 18:58:42 +0800 Subject: [PATCH 48/51] Delete README.md [skip ci] --- .../core-java/src/main/java/com/baeldung/classloader/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md b/core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md deleted file mode 100644 index e26a3e2de9..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/classloader/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Class Loaders in Java](https://www.baeldung.com/java-classloaders) From 28f4d3e45db7838bb6328651167f991e337329ee Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 19:00:02 +0800 Subject: [PATCH 49/51] Update README.md [skip ci] --- persistence-modules/java-jpa/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md index 554e10dc98..ca9ec0d74d 100644 --- a/persistence-modules/java-jpa/README.md +++ b/persistence-modules/java-jpa/README.md @@ -2,7 +2,7 @@ - [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) - [A Guide to Stored Procedures with JPA](http://www.baeldung.com/jpa-stored-procedures) -- [Fixing the JPA error “java.lang.String cannot be cast to [Ljava.lang.String;”]](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) +- [Fixing the JPA error “java.lang.String cannot be cast to Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast) - [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph) - [JPA 2.2 Support for Java 8 Date/Time Types](https://www.baeldung.com/jpa-java-time) - [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date) From b0f5f1de33adc98a7e9478fcebe839d03e38161e Mon Sep 17 00:00:00 2001 From: sheryllresulta <48046330+sheryllresulta@users.noreply.github.com> Date: Wed, 29 May 2019 19:10:25 +0800 Subject: [PATCH 50/51] Update README.md [skip ci] From 6ab6db7d9dc1a6bba134e584be8d4a3ea976f549 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Thu, 30 May 2019 16:05:17 +0530 Subject: [PATCH 51/51] [BAEL-14840] - Fixed integration tests in apache-geode --- ...odeSamplesIntegrationTest.java => GeodeSamplesLiveTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename apache-geode/src/test/java/com/baeldung/geode/{GeodeSamplesIntegrationTest.java => GeodeSamplesLiveTest.java} (98%) diff --git a/apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesIntegrationTest.java b/apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesLiveTest.java similarity index 98% rename from apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesIntegrationTest.java rename to apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesLiveTest.java index b96d2c9b6a..359568db98 100644 --- a/apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesIntegrationTest.java +++ b/apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesLiveTest.java @@ -21,7 +21,7 @@ import java.util.stream.Stream; import static org.junit.Assert.assertEquals; -public class GeodeSamplesIntegrationTest { +public class GeodeSamplesLiveTest { ClientCache cache = null; Region region = null;