HHH-18598 allow only List types to control via JoinTable

This commit is contained in:
Erdem A Memisyazici 2024-09-13 18:27:36 -04:00
parent 4deb2d9342
commit 4eb03b72a7
No known key found for this signature in database
GPG Key ID: 9D0AE134AC90ABD2
1 changed files with 9 additions and 1 deletions

View File

@ -2189,10 +2189,18 @@ public abstract class CollectionBinder {
bindCollectionSecondPass( targetEntity, joinColumns );
if ( isCollectionOfEntities ) {
final ClassDetails collectionClassDetails = property.getType().determineRawClass();
final Class<?> collectionClass = collectionClassDetails.toJavaClass();
final AnnotatedJoinColumn firstInverseJoinColumn = inverseJoinColumns.getJoinColumns().get(0);
final ManyToOne element = handleCollectionOfEntities( elementType, targetEntity, hqlOrderBy );
bindManyToManyInverseForeignKey( targetEntity, inverseJoinColumns, element, firstInverseJoinColumn.isUnique() );
bindManyToManyInverseForeignKey(
targetEntity,
inverseJoinColumns,
element,
java.util.List.class.isAssignableFrom(collectionClass) ? firstInverseJoinColumn.isUnique() : oneToMany
);
}
else if ( isManyToAny ) {
handleManyToAny();