Skip to content

Commit

Permalink
HHH-17964 Hibernate using wrong column order for ElementCollection qu…
Browse files Browse the repository at this point in the history
…ery when composite ID is present
  • Loading branch information
dreab8 authored and beikov committed Apr 25, 2024
1 parent 2b4ec1f commit 2811aad
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,10 @@ private static void bindImplicitColumns(
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);
Expand All @@ -767,6 +768,11 @@ private static void bindImplicitColumns(
}
}
}
if ( keyValue instanceof Component
&& ( (Component) keyValue ).isSorted()
&& value instanceof DependantValue ) {
( (DependantValue) value ).setSorted( true );
}
}

private static void bindUnownedAssociation(
Expand Down

0 comments on commit 2811aad

Please sign in to comment.