Set comparator on Persistent SortedSet and SortedMap collection instances

This commit is contained in:
Chris Cranford 2021-03-09 18:33:43 -05:00 committed by Christian Beikov
parent 4292d118ad
commit 71f633a8f7
2 changed files with 6 additions and 2 deletions

View File

@ -49,7 +49,9 @@ public class StandardSortedMapSemantics<K,V> extends AbstractMapSemantics<Sorted
Object key,
CollectionPersister collectionDescriptor,
SharedSessionContractImplementor session) {
return new PersistentSortedMap<>( session );
final PersistentSortedMap<K,V> result = new PersistentSortedMap<>( session );
result.setComparator( (Comparator<K>) collectionDescriptor.getSortingComparator() );
return result;
}
@Override

View File

@ -50,7 +50,9 @@ public class StandardSortedSetSemantics<E> extends AbstractSetSemantics<SortedSe
Object key,
CollectionPersister collectionDescriptor,
SharedSessionContractImplementor session) {
return new PersistentSortedSet<>( session );
final PersistentSortedSet<E> result = new PersistentSortedSet<>( session );
result.setComparator( (Comparator<E>) collectionDescriptor.getSortingComparator() );
return result;
}
@Override