From 9d697660f65be0529559386f6369acbdcb4c2eeb Mon Sep 17 00:00:00 2001 From: Manuel Bernhardt Date: Tue, 22 Feb 2011 17:52:45 +0100 Subject: [PATCH] HHH-5947: 'Fix' that at least improves the error message --- .../src/main/java/org/hibernate/cfg/Configuration.java | 4 ++-- .../hibernate/test/annotations/uniqueconstraint/House.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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;