diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java index 15cf84c849..6d60ef5c20 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java @@ -139,7 +139,7 @@ public class BinderHelper { * to need the value when it writes the association.) *
* Complicating this hugely is the fact that an association might
- * be based on a composite key with multiple {@code @JoinColumns},
+ * be based on a composite key with multiple {@code @JoinColumn}s,
* and so the referenced columns might even be spread out over
* multiple fields or properties of the target entity. There's
* even some extra minor complications resulting from multi-table
@@ -231,14 +231,14 @@ public class BinderHelper {
final Object owner = findColumnOwner( targetEntity, column.getReferencedColumn(), context );
if ( owner == null ) {
throw new AnnotationException( "A '@JoinColumn' for association "
- + associationMessage(associatedEntity, firstColumn)
+ + associationMessage( associatedEntity, firstColumn )
+ " references a column named '" + column.getReferencedColumn()
+ "' which is not mapped by the target entity '"
+ targetEntity.getEntityName() + "'" );
}
if ( owner != columnOwner) {
throw new AnnotationException( "The '@JoinColumn's for association "
- + associationMessage(associatedEntity, firstColumn)
+ + associationMessage( associatedEntity, firstColumn )
+ " reference columns of different tables mapped by the target entity '"
+ targetEntity.getEntityName() + "' ('" + column.getReferencedColumn() +
"' belongs to a different table to '" + firstColumn.getReferencedColumn() + "'" );
@@ -440,13 +440,15 @@ public class BinderHelper {
// specified by the @JoinColumn annotations.
final List