[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2048?page=c...
]
Barney Boisvert commented on HHH-2048:
--------------------------------------
Here's a patch. Enormously easier to debug erroneous mappings with this little
addition
Index:
/home/barneyb/workspaces/audiencecentral/Swordfish/src/org/hibernate/mapping/SimpleValue.java
===================================================================
---
/home/barneyb/workspaces/audiencecentral/Swordfish/src/org/hibernate/mapping/SimpleValue.java (revision
250)
+++
/home/barneyb/workspaces/audiencecentral/Swordfish/src/org/hibernate/mapping/SimpleValue.java (working
copy)
@@ -260,6 +260,9 @@
Type result = TypeFactory.heuristicType(typeName, typeParameters);
if (result==null) {
String msg = "Could not determine type for: " + typeName;
+ if(table != null){
+ msg += ", at table: " + table.getName();
+ }
if(columns!=null && columns.size()>0) {
msg += ", for columns: " + columns;
}
Incomplete MappingException at org.hibernate.mapping.SimpleValue
----------------------------------------------------------------
Key: HHH-2048
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2048
Project: Hibernate3
Type: Improvement
Versions: 3.2.0.cr4
Reporter: Diego Pires Plentz
When a mapped class has a wrong type, an exception is throwed, but it doesnt say nothing
about what class/table is mapped wrongly.
public Type getType() throws MappingException {
if (typeName==null) {
throw new MappingException("No type name");
}
Type result = TypeFactory.heuristicType(typeName, typeParameters);
if (result==null) {
String msg = "Could not determine type for: " + typeName;
if(columns!=null && columns.size()>0) {
msg += ", for columns: " + columns;
}
throw new MappingException(msg);
}
return result;
}
Can become something like this...
public Type getType() throws MappingException {
if (typeName==null) {
throw new MappingException("No type name");
}
Type result = TypeFactory.heuristicType(typeName, typeParameters);
if (result==null) {
String msg = "Could not determine type for: " + typeName;
if(table != null){
msg += ", at table: " + table.getName();
}
if(columns!=null && columns.size()>0) {
msg += ", for columns: " + columns;
}
throw new MappingException(msg);
}
return result;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira