Skip to content

Commit a5331ad

Browse files
cigalymbellade
authored andcommitted
HHH-19195 Discriminator values should be hierarchically sorted.
While collecting they are inserted in proper order, but TreeMap will not preserver ordering, but sort them alphabetically by names. To keep values order LinkedHashMap should be used instead of TreeMap.
1 parent 6b04816 commit a5331ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import java.lang.reflect.Type;
1212
import java.util.ArrayList;
1313
import java.util.HashMap;
14+
import java.util.LinkedHashMap;
1415
import java.util.List;
1516
import java.util.Map;
16-
import java.util.TreeMap;
1717

1818
import org.hibernate.AnnotationException;
1919
import org.hibernate.annotations.DiscriminatorFormula;
@@ -408,7 +408,7 @@ static Component fillEmbeddable(
408408
final BasicType<?> discriminatorType = (BasicType<?>) component.getDiscriminator().getType();
409409
// Discriminator values are used to construct the embeddable domain
410410
// type hierarchy so order of processing is important
411-
final Map<Object, String> discriminatorValues = new TreeMap<>();
411+
final Map<Object, String> discriminatorValues = new LinkedHashMap<>();
412412
collectDiscriminatorValue( returnedClassOrElement, discriminatorType, discriminatorValues );
413413
collectSubclassElements(
414414
propertyAccessor,

0 commit comments

Comments
 (0)