Skip to content

Commit

Permalink
fix exceptions for a certain kind of wrong join column mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Dec 26, 2022
1 parent 408e0ec commit c7bad70
Showing 1 changed file with 4 additions and 6 deletions.
Expand Up @@ -450,9 +450,8 @@ private static String handleTargetEntity(
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() );
Expand All @@ -465,9 +464,8 @@ private static String handleTargetEntity(
}
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;
Expand Down

0 comments on commit c7bad70

Please sign in to comment.