diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java index e6f6bf5739..744867c731 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java @@ -1550,7 +1550,7 @@ public class Configuration implements Serializable { sb.append( columnName ).append( ", " ); } sb.setLength( sb.length() - 2 ); - sb.append( ") on table " ).append( table.getName() ).append( ": " ); + sb.append( ") on table " ).append( table.getName() ).append( ": database column " ); for ( Column column : unbound ) { sb.append( column.getName() ).append( ", " ); } @@ -1558,7 +1558,7 @@ public class Configuration implements Serializable { sb.append( column.getName() ).append( ", " ); } sb.setLength( sb.length() - 2 ); - sb.append( " not found" ); + sb.append( " not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)" ); throw new AnnotationException( sb.toString() ); } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java index d5a41e2055..2d6ffaf528 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/uniqueconstraint/House.java @@ -9,7 +9,7 @@ import javax.persistence.UniqueConstraint; * @author Manuel Bernhardt */ @Entity -@Table(uniqueConstraints = {@UniqueConstraint(name = "uniqueWithInherited", columnNames = {"room", "cost"} )}) +@Table(uniqueConstraints = {@UniqueConstraint(name = "uniqueWithInherited", columnNames = {"room_id", "cost"} )}) public class House extends Building { public Long id;