[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3210) "No type name" MappingException message is far too cryptic

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Mon Mar 31 10:25:32 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29912 ] 

Max Rydahl Andersen commented on HHH-3210:
------------------------------------------

Darryl - i'm not getting you ;)

your patch is about things in hibernate core, but you talk about changes to Hibernate Tools....i've moved it to hibernate core until I get why you think this is related to hibernate tools.

> "No type name" MappingException message is far too cryptic
> ----------------------------------------------------------
>
>                 Key: HHH-3210
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3210
>             Project: Hibernate3
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.2.1
>            Reporter: Darryl Miles
>            Priority: Minor
>
> Having to resort to stepping into Hibernate code to find where this exception is making hard work for developers.  Basically the problem is that the message does not inform the developer exactly which class and which column has the problem (so we need some context information emitted with the "No type name").  The rest of the method does have code to generate a useful exception message if(result==null){}
> http://fisheye.labs.jboss.com/browse/Hibernate/core/tags/hibernate-3.3.0.CR1/core/src/main/java/org/hibernate/mapping/SimpleValue.java?r=11588#l258
> 	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;
> 	}
> Example mapping that cause the problem:
> 	<class name="domain.MyData" table="my_data">
> 		<id name="myDataId" type="long" column="my_data_id">
> 			<generator class="native" />
> 		</id>
> 		<list name="abcList" table="my_data_list" cascade="all-delete-orphan">
> 			<key column="my_data_id"/>
> 			<index column="sort_order"/>
> 			<element column="value" not-null="true" />  <!-- type="" was missing here! -->
> 		</list>
> 	</class>

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list