From 71f633a8f7970ca357c8518846774f948ea525e6 Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Tue, 9 Mar 2021 18:33:43 -0500 Subject: [PATCH] Set comparator on Persistent SortedSet and SortedMap collection instances --- .../collection/internal/StandardSortedMapSemantics.java | 4 +++- .../collection/internal/StandardSortedSetSemantics.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedMapSemantics.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedMapSemantics.java index 3664d7afb4..88eedc63c4 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedMapSemantics.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedMapSemantics.java @@ -49,7 +49,9 @@ public class StandardSortedMapSemantics extends AbstractMapSemantics( session ); + final PersistentSortedMap result = new PersistentSortedMap<>( session ); + result.setComparator( (Comparator) collectionDescriptor.getSortingComparator() ); + return result; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedSetSemantics.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedSetSemantics.java index 4d4be32b19..86c98e7e9a 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedSetSemantics.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/StandardSortedSetSemantics.java @@ -50,7 +50,9 @@ public class StandardSortedSetSemantics extends AbstractSetSemantics( session ); + final PersistentSortedSet result = new PersistentSortedSet<>( session ); + result.setComparator( (Comparator) collectionDescriptor.getSortingComparator() ); + return result; } @Override