HHH-17964 Hibernate using wrong column order for ElementCollection query when composite ID is present

This commit is contained in:
Andrea Boriero 2024-04-24 14:01:40 +02:00 committed by Christian Beikov
parent a1739979d1
commit 2202487633
1 changed files with 9 additions and 3 deletions

View File

@ -743,9 +743,10 @@ public class TableBinder {
PersistentClass referencedEntity,
AnnotatedJoinColumns joinColumns,
SimpleValue value) {
final List<Column> idColumns = referencedEntity instanceof JoinedSubclass
? referencedEntity.getKey().getColumns()
: referencedEntity.getIdentifier().getColumns();
final KeyValue keyValue = referencedEntity instanceof JoinedSubclass
? referencedEntity.getKey()
: referencedEntity.getIdentifier();
final List<Column> idColumns = keyValue.getColumns();
for ( int i = 0; i < idColumns.size(); i++ ) {
final Column column = idColumns.get(i);
final AnnotatedJoinColumn firstColumn = joinColumns.getJoinColumns().get(0);
@ -767,6 +768,11 @@ public class TableBinder {
}
}
}
if ( keyValue instanceof Component
&& ( (Component) keyValue ).isSorted()
&& value instanceof DependantValue ) {
( (DependantValue) value ).setSorted( true );
}
}
private static void bindUnownedAssociation(