From f401f6ba9e78a63abb6cf195bdf7d0dddfb917df Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sat, 18 Dec 2021 23:00:24 +0530 Subject: [PATCH] JAVA-8357: Split or move hibernate-jpa module --- .../hibernate-exceptions/README.md | 1 + .../hibernate-exceptions/pom.xml | 5 ++++ .../entitynotfoundexception/Category.java | 0 .../entitynotfoundexception/Item.java | 0 .../entitynotfoundexception/User.java | 0 .../main/resources/META-INF/persistence.xml | 23 +++++++++++++++++++ ...ntityNotFoundExceptionIntegrationTest.java | 0 persistence-modules/hibernate-jpa/README.md | 3 +-- .../main/resources/META-INF/persistence.xml | 17 -------------- 9 files changed, 30 insertions(+), 19 deletions(-) rename persistence-modules/{hibernate-jpa => hibernate-exceptions}/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Category.java (100%) rename persistence-modules/{hibernate-jpa => hibernate-exceptions}/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java (100%) rename persistence-modules/{hibernate-jpa => hibernate-exceptions}/src/main/java/com/baeldung/hibernate/entitynotfoundexception/User.java (100%) create mode 100644 persistence-modules/hibernate-exceptions/src/main/resources/META-INF/persistence.xml rename persistence-modules/{hibernate-jpa => hibernate-exceptions}/src/test/java/com/baeldung/hibernate/entitynotfoundexception/EntityNotFoundExceptionIntegrationTest.java (100%) diff --git a/persistence-modules/hibernate-exceptions/README.md b/persistence-modules/hibernate-exceptions/README.md index 7c4f96280e..2e5a98c2f8 100644 --- a/persistence-modules/hibernate-exceptions/README.md +++ b/persistence-modules/hibernate-exceptions/README.md @@ -4,3 +4,4 @@ - [Hibernate Error “No Persistence Provider for EntityManager”](https://www.baeldung.com/hibernate-no-persistence-provider) - [TransactionRequiredException Error](https://www.baeldung.com/jpa-transaction-required-exception) - [Hibernate’s “Object References an Unsaved Transient Instance” Error](https://www.baeldung.com/hibernate-unsaved-transient-instance-error) +- [EntityNotFoundException in Hibernate](https://www.baeldung.com/hibernate-entitynotfoundexception) diff --git a/persistence-modules/hibernate-exceptions/pom.xml b/persistence-modules/hibernate-exceptions/pom.xml index 89e1f4ca7e..cabace17b9 100644 --- a/persistence-modules/hibernate-exceptions/pom.xml +++ b/persistence-modules/hibernate-exceptions/pom.xml @@ -29,6 +29,11 @@ jaxb-api ${jaxb.version} + + com.h2database + h2 + ${h2.version} + diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Category.java b/persistence-modules/hibernate-exceptions/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Category.java similarity index 100% rename from persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Category.java rename to persistence-modules/hibernate-exceptions/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Category.java diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java b/persistence-modules/hibernate-exceptions/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java similarity index 100% rename from persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java rename to persistence-modules/hibernate-exceptions/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/User.java b/persistence-modules/hibernate-exceptions/src/main/java/com/baeldung/hibernate/entitynotfoundexception/User.java similarity index 100% rename from persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/User.java rename to persistence-modules/hibernate-exceptions/src/main/java/com/baeldung/hibernate/entitynotfoundexception/User.java diff --git a/persistence-modules/hibernate-exceptions/src/main/resources/META-INF/persistence.xml b/persistence-modules/hibernate-exceptions/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..4e83a57f48 --- /dev/null +++ b/persistence-modules/hibernate-exceptions/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,23 @@ + + + + EntityManager EntityNotFoundException persistence unit + com.baeldung.hibernate.entitynotfoundexception.Category + com.baeldung.hibernate.entitynotfoundexception.Item + com.baeldung.hibernate.entitynotfoundexception.User + true + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitynotfoundexception/EntityNotFoundExceptionIntegrationTest.java b/persistence-modules/hibernate-exceptions/src/test/java/com/baeldung/hibernate/entitynotfoundexception/EntityNotFoundExceptionIntegrationTest.java similarity index 100% rename from persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitynotfoundexception/EntityNotFoundExceptionIntegrationTest.java rename to persistence-modules/hibernate-exceptions/src/test/java/com/baeldung/hibernate/entitynotfoundexception/EntityNotFoundExceptionIntegrationTest.java diff --git a/persistence-modules/hibernate-jpa/README.md b/persistence-modules/hibernate-jpa/README.md index bb079b1705..5599140732 100644 --- a/persistence-modules/hibernate-jpa/README.md +++ b/persistence-modules/hibernate-jpa/README.md @@ -13,5 +13,4 @@ This module contains articles specific to use of Hibernate as a JPA implementati - [Enabling Transaction Locks in Spring Data JPA](https://www.baeldung.com/java-jpa-transaction-locks) - [JPA/Hibernate Persistence Context](https://www.baeldung.com/jpa-hibernate-persistence-context) - [Quick Guide to EntityManager#getReference()](https://www.baeldung.com/jpa-entity-manager-get-reference) -- [JPA Entities and the Serializable Interface](https://www.baeldung.com/jpa-entities-serializable) -- [EntityNotFoundException in Hibernate](https://www.baeldung.com/hibernate-entitynotfoundexception) +- [JPA Entities and the Serializable Interface](https://www.baeldung.com/jpa-entities-serializable) \ No newline at end of file diff --git a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml index e895ac6ba9..12b41a4973 100644 --- a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml @@ -120,21 +120,4 @@ - - EntityManager EntityNotFoundException persistence unit - com.baeldung.hibernate.entitynotfoundexception.Category - com.baeldung.hibernate.entitynotfoundexception.Item - com.baeldung.hibernate.entitynotfoundexception.User - true - - - - - - - - - - - \ No newline at end of file