HHH-15057 Fix exception on persisting bidirectional, list many-to-many association

This commit is contained in:
Yoann Rodière 2022-01-28 16:00:58 +01:00 committed by Christian Beikov
parent 4f6b60e3ee
commit c861e465a7
1 changed files with 5 additions and 0 deletions

View File

@ -557,6 +557,11 @@ public abstract class CollectionBinder {
|| property.isAnnotationPresent( OrderBy.class ) ) {
return CollectionClassification.BAG;
}
ManyToMany manyToMany = property.getAnnotation( ManyToMany.class );
if ( manyToMany != null && ! StringHelper.isEmpty( manyToMany.mappedBy() ) ) {
// We don't support @OrderColumn on the non-owning side of a many-to-many association.
return CollectionClassification.BAG;
}
// otherwise, return the implicit classification for List attributes
return buildingContext.getBuildingOptions().getMappingDefaults().getImplicitListClassification();
}