fix exceptions for a certain kind of wrong join column mapping

This commit is contained in:
Gavin 2022-12-24 16:17:25 +01:00 committed by Gavin King
parent 408e0ec436
commit c7bad70073
1 changed files with 4 additions and 6 deletions

View File

@ -450,9 +450,8 @@ public abstract class CollectionBinder {
final ReflectionManager reflectionManager = context.getBootstrapContext().getReflectionManager();
if ( oneToManyAnn != null ) {
if ( joinColumns.isSecondary() ) {
throw new AssertionFailure(
"Collections having FK in secondary table - " + getPath( propertyHolder, inferredData )
);
throw new AnnotationException( "Collection '" + getPath( propertyHolder, inferredData )
+ "' has foreign key in secondary table" );
}
collectionBinder.setFkJoinColumns( joinColumns );
mappedBy = nullIfEmpty( oneToManyAnn.mappedBy() );
@ -465,9 +464,8 @@ public abstract class CollectionBinder {
}
else if ( elementCollectionAnn != null ) {
if ( joinColumns.isSecondary() ) {
throw new AssertionFailure(
"Collections having FK in secondary table - " + getPath( propertyHolder, inferredData )
);
throw new AnnotationException( "Collection '" + getPath( propertyHolder, inferredData )
+ "' has foreign key in secondary table" );
}
collectionBinder.setFkJoinColumns( joinColumns );
mappedBy = null;