From d407e737754f0a50fcc0b06bc80f159622e45058 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Thu, 23 Jun 2016 00:20:57 -0700 Subject: [PATCH] HHH-10648 : Backport corrections --- .../loader/plan/exec/internal/AbstractLoadQueryDetails.java | 2 +- .../plan/exec/internal/LoadQueryJoinAndFetchProcessor.java | 5 +++-- .../test/collection/bag/MultipleBagFetchHqlTest.java | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadQueryDetails.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadQueryDetails.java index 07fdd2421c..c08a240317 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadQueryDetails.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadQueryDetails.java @@ -171,7 +171,7 @@ public abstract class AbstractLoadQueryDetails implements LoadQueryDetails { } if ( fetchStats != null && fetchStats.getJoinedBagAttributeFetches().size() > 1 ) { - final List bagRoles = new ArrayList<>(); + final List bagRoles = new ArrayList(); for ( CollectionAttributeFetch bagFetch : fetchStats.getJoinedBagAttributeFetches() ) { bagRoles.add( bagFetch.getCollectionPersister().getRole() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/LoadQueryJoinAndFetchProcessor.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/LoadQueryJoinAndFetchProcessor.java index 8d801b81a6..4d3a884041 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/LoadQueryJoinAndFetchProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/LoadQueryJoinAndFetchProcessor.java @@ -673,7 +673,7 @@ public class LoadQueryJoinAndFetchProcessor { } if ( isJoinFetchedBag( fetch ) ) { if ( joinedBagAttributeFetches == null ) { - joinedBagAttributeFetches = new HashSet<>(); + joinedBagAttributeFetches = new HashSet(); } joinedBagAttributeFetches.add( (CollectionAttributeFetch) fetch ); } @@ -685,8 +685,9 @@ public class LoadQueryJoinAndFetchProcessor { } @Override + @SuppressWarnings({"unchecked"}) public Set getJoinedBagAttributeFetches() { - return joinedBagAttributeFetches == null ? Collections.emptySet() : joinedBagAttributeFetches; + return joinedBagAttributeFetches == null ? Collections.EMPTY_SET : joinedBagAttributeFetches; } private boolean isJoinFetchedBag(Fetch fetch) { diff --git a/hibernate-core/src/test/java/org/hibernate/test/collection/bag/MultipleBagFetchHqlTest.java b/hibernate-core/src/test/java/org/hibernate/test/collection/bag/MultipleBagFetchHqlTest.java index ce3778de41..79c7c0dd7c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/collection/bag/MultipleBagFetchHqlTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/collection/bag/MultipleBagFetchHqlTest.java @@ -73,10 +73,8 @@ public class MultipleBagFetchHqlTest extends BaseCoreFunctionalTestCase { .uniqueResult(); fail("Should throw org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags"); } - catch ( IllegalArgumentException expected ) { + catch ( MultipleBagFetchException expected ) { session.getTransaction().rollback(); - // MultipleBagFetchException was converted to IllegalArgumentException - assertTrue( MultipleBagFetchException.class.isInstance( expected.getCause() ) ); } finally { session.close();