[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3170) PersistentClass classname is not revealed in MappingException

Paul Benedict (JIRA) noreply at atlassian.com
Tue Apr 29 19:02:33 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated HHH-3170:
-------------------------------

    Attachment: SimpleValue.java

I could not create a patch, but I did attach the modified file. Only one alteration has been made: line 266 has been added to also print out the table name. Now the error reveals to the user not only the type and columns, but also the table holding the columns.

e.g.:
String msg = "Could not determine type for: " + typeName;
if(columns!=null && columns.size()>0) {
  msg += ", for columns: " + columns;
}
msg += ", from table: " + table.getName();


> PersistentClass classname is not revealed in MappingException
> -------------------------------------------------------------
>
>                 Key: HHH-3170
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3170
>             Project: Hibernate3
>          Issue Type: Improvement
>    Affects Versions: 3.2.x, 3.3.0.CR1
>            Reporter: Paul Benedict
>         Attachments: SimpleValue.java
>
>
> A typical exception from bad configuration is:
> Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Map, for columns: [org.hibernate.mapping.Column(name)]
> Recommendation:
> The "org.hibernate.cfg.Configuration" class should catch the exception and add the name of the offending PersistentClass. The class is held by the iterator. 
> Line 1100 improvement:
> private void validate() throws MappingException {
>   Iterator iter = classes.values().iterator();
>   while ( iter.hasNext() ) {
>   PersistentClass pc = (PersistentClass) iter.next();
>   try {
>     pc.validate( mapping );
>   } catch(MappingException e) {
>     throw new MappingException(pc.getClassName(), e);
>   }
>   ....
> }
> Otherwise, I find it incredibly difficult to find the offending class without a step debugger.

-- 
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