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

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Mon Mar 31 09:07:33 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29910 ] 

Max Rydahl Andersen commented on HBX-1054:
------------------------------------------

any particular reason you are reporting this in HBX ?

Maybe we could fix it in higher levels of tooling code so it depends very much of what the underlying call stacktrace is...

> "No type name" MappingException message is far too cryptic
> ----------------------------------------------------------
>
>                 Key: HBX-1054
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1054
>             Project: Hibernate Tools
>          Issue Type: Improvement
>          Components: hbmlint
>    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