diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 9eb7ca1f1d..3569f83d7b 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -85,6 +85,7 @@ spring-data-jpa-query-3 spring-data-jpa-repo spring-data-jpa-repo-2 + spring-data-jpa-repo-4 spring-data-jdbc spring-data-keyvalue spring-data-mongodb diff --git a/persistence-modules/spring-data-jpa-repo-2/README.md b/persistence-modules/spring-data-jpa-repo-2/README.md index 12eeddae7f..23134ec02d 100644 --- a/persistence-modules/spring-data-jpa-repo-2/README.md +++ b/persistence-modules/spring-data-jpa-repo-2/README.md @@ -9,6 +9,4 @@ - [Difference Between JPA and Spring Data JPA](https://www.baeldung.com/spring-data-jpa-vs-jpa) - [Differences Between Spring Data JPA findFirst() and findTop()](https://www.baeldung.com/spring-data-jpa-findfirst-vs-findtop) - [Difference Between findBy and findAllBy in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-find-by-vs-find-all-by) -- [Unidirectional One-to-Many and Cascading Delete in JPA](https://www.baeldung.com/spring-jpa-unidirectional-one-to-many-and-cascading-delete) -- [TRUNCATE TABLE in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-truncate-table) - More articles: [[<-- prev]](../spring-data-jpa-repo) diff --git a/persistence-modules/spring-data-jpa-repo-4/README.md b/persistence-modules/spring-data-jpa-repo-4/README.md new file mode 100644 index 0000000000..a8afbbe733 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-4/README.md @@ -0,0 +1,7 @@ +## Spring Data JPA - Repositories + +### Relevant Articles: + +- [Unidirectional One-to-Many and Cascading Delete in JPA](https://www.baeldung.com/spring-jpa-unidirectional-one-to-many-and-cascading-delete) +- [TRUNCATE TABLE in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-truncate-table) +- More articles: [[<-- prev]](../spring-data-jpa-repo-3) diff --git a/persistence-modules/spring-data-jpa-repo-4/pom.xml b/persistence-modules/spring-data-jpa-repo-4/pom.xml new file mode 100644 index 0000000000..c823391d9f --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-4/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + spring-data-jpa-repo-4 + spring-data-jpa-repo-4 + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + javax.persistence + javax.persistence-api + + + org.springframework.data + spring-data-jpa + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + com.querydsl + querydsl-apt + + + com.querydsl + querydsl-jpa + + + com.google.guava + guava + ${guava.version} + + + + + + + com.mysema.maven + apt-maven-plugin + 1.1.3 + + + generate-sources + + process + + + ${project.build.directory}/generated-sources + com.querydsl.apt.jpa.JPAAnnotationProcessor + + + + + + org.bsc.maven + maven-processor-plugin + 3.3.3 + + + process + + process + + generate-sources + + ${project.build.directory}/generated-sources + + org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor + + + + + + + org.hibernate + hibernate-jpamodelgen + 5.6.11.Final + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/EntityManagerRepository.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/EntityManagerRepository.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/EntityManagerRepository.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/EntityManagerRepository.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/JdbcTemplateRepository.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/JdbcTemplateRepository.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/JdbcTemplateRepository.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/JdbcTemplateRepository.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntity.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntity.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntity.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntity.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntityRepository.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntityRepository.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntityRepository.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/MyEntityRepository.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/TruncateSpringBootApplication.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/TruncateSpringBootApplication.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/truncate/TruncateSpringBootApplication.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/truncate/TruncateSpringBootApplication.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Article.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Article.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Article.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Article.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleRepository.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleRepository.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleRepository.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleRepository.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleService.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleService.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleService.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/ArticleService.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CascadingDeleteApplication.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CascadingDeleteApplication.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CascadingDeleteApplication.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CascadingDeleteApplication.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Comment.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Comment.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Comment.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/Comment.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CommentRepository.java b/persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CommentRepository.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CommentRepository.java rename to persistence-modules/spring-data-jpa-repo-4/src/main/java/com/baeldung/spring/data/persistence/unidirectionalcascadingdelete/CommentRepository.java diff --git a/persistence-modules/spring-data-jpa-repo-4/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-repo-4/src/main/resources/application.properties new file mode 100644 index 0000000000..db4837d8d2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-4/src/main/resources/application.properties @@ -0,0 +1,11 @@ +spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +spring.datasource.username=sa +spring.datasource.password=sa + +spring.jpa.properties.hibernate.globally_quoted_identifiers=true +logging.level.com.baeldung.spring.data.persistence.search=debug + +spring.jpa.show-sql=true +logging.level.org.hibernate.SQL=DEBUG +logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE +spring.jpa.properties.hibernate.format_sql=true diff --git a/persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/deletionCascading/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo-4/src/test/java/com/baeldung/spring/data/persistence/deletionCascading/ArticleRepositoryIntegrationTest.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/deletionCascading/ArticleRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa-repo-4/src/test/java/com/baeldung/spring/data/persistence/deletionCascading/ArticleRepositoryIntegrationTest.java diff --git a/persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/truncate/TruncateIntegrationTest.java b/persistence-modules/spring-data-jpa-repo-4/src/test/java/com/baeldung/spring/data/persistence/truncate/TruncateIntegrationTest.java similarity index 100% rename from persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/truncate/TruncateIntegrationTest.java rename to persistence-modules/spring-data-jpa-repo-4/src/test/java/com/baeldung/spring/data/persistence/truncate/TruncateIntegrationTest.java diff --git a/persistence-modules/spring-data-jpa-repo-4/src/test/resources/logback-test.xml b/persistence-modules/spring-data-jpa-repo-4/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..8d4771e308 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-4/src/test/resources/logback-test.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + \ No newline at end of file