diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/TableBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/TableBinder.java index 7cf8feca40..7b8083dff4 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/TableBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/TableBinder.java @@ -631,7 +631,16 @@ public class TableBinder { } } if ( value instanceof ToOne ) { - ( (ToOne) value).setSorted( true ); + ( (ToOne) value ).setSorted( true ); + } + else if ( value instanceof DependantValue ) { + ( (DependantValue) value ).setSorted( true ); + } + else { + throw new AssertionError( + "This should never happen, value can only be ToOne or DependantValue," + + "instead it's '" + value.getClass().getName() + "'" + ); } }