Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb74502

Browse files
authored
[BAEL-4056] Guide to MultipleBagFetchException (eugenp#10304)
* Removes DummyEntity * Uses Artist Entity instead of DummyEntity
1 parent c85ba51 commit bb74502

File tree

3 files changed

+3
-47
lines changed

3 files changed

+3
-47
lines changed

persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/multiplebagfetchexception/DummyEntity.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
</persistence-unit>
5858
<persistence-unit name="jpa-h2-multiple-bag-fetch-exception">
5959
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
60-
<class>com.baeldung.jpa.multiplebagfetchexception.DummyEntity</class>
6160
<class>com.baeldung.jpa.multiplebagfetchexception.Album</class>
6261
<class>com.baeldung.jpa.multiplebagfetchexception.Song</class>
6362
<class>com.baeldung.jpa.multiplebagfetchexception.User</class>

persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/multiplebagfetchexception/MultipleBagFetchExceptionIntegrationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public static void setup() {
2929
public void whenFetchingMoreThanOneBag_thenThrowAnException() {
3030
IllegalArgumentException exception =
3131
assertThrows(IllegalArgumentException.class, () -> {
32-
String jpql = "SELECT dummy FROM DummyEntity dummy "
33-
+ "JOIN FETCH dummy.collection1 "
34-
+ "JOIN FETCH dummy.collection2 ";
32+
String jpql = "SELECT artist FROM Artist artist "
33+
+ "JOIN FETCH artist.songs "
34+
+ "JOIN FETCH artist.offers ";
3535

3636
entityManager.createQuery(jpql);
3737
});

0 commit comments

Comments
 (0)