diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/multiplebagfetchexception/DummyEntity.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/multiplebagfetchexception/DummyEntity.java deleted file mode 100644 index 8eb9c95724..0000000000 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/multiplebagfetchexception/DummyEntity.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baeldung.jpa.multiplebagfetchexception; - -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import java.util.List; -import java.util.Objects; - -@Entity -class DummyEntity { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - - @ElementCollection - private List collection1; - - @ElementCollection - private List collection2; - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - DummyEntity that = (DummyEntity) o; - - return Objects.equals(id, that.id); - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - protected DummyEntity() { - } -} diff --git a/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml index 46090c51d7..f428fea07b 100644 --- a/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml @@ -57,7 +57,6 @@ org.hibernate.jpa.HibernatePersistenceProvider - com.baeldung.jpa.multiplebagfetchexception.DummyEntity com.baeldung.jpa.multiplebagfetchexception.Album com.baeldung.jpa.multiplebagfetchexception.Song com.baeldung.jpa.multiplebagfetchexception.User diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/multiplebagfetchexception/MultipleBagFetchExceptionIntegrationTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/multiplebagfetchexception/MultipleBagFetchExceptionIntegrationTest.java index f607bbeae4..648650ad8a 100644 --- a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/multiplebagfetchexception/MultipleBagFetchExceptionIntegrationTest.java +++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/multiplebagfetchexception/MultipleBagFetchExceptionIntegrationTest.java @@ -29,9 +29,9 @@ public class MultipleBagFetchExceptionIntegrationTest { public void whenFetchingMoreThanOneBag_thenThrowAnException() { IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> { - String jpql = "SELECT dummy FROM DummyEntity dummy " - + "JOIN FETCH dummy.collection1 " - + "JOIN FETCH dummy.collection2 "; + String jpql = "SELECT artist FROM Artist artist " + + "JOIN FETCH artist.songs " + + "JOIN FETCH artist.offers "; entityManager.createQuery(jpql); });