]
Koda Janh commented on HHH-2852:
--------------------------------
Hibernate is the only project I know of where developers won't let you report problems
unless you are personally able to fix them. I know this might shock you but not everyone
here would like to develop Hibernate for a living (we already have a job). The fact that
we develop software with Hibernate does not necessarily mean we'd like to develop
Hibernate itself.
I can appreciate Hibernate developers' reluctance to deal with an overwhelmingly
amount of bug reports but I honestly believe that improving error messages
across-the-board will decrease the number and urgency of such reports, not increase them.
Just my 2 cents.
Better error messages when schema validation fails
--------------------------------------------------
Key: HHH-2852
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2852
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.0.ga
Reporter: Eirik Maus
Assignee: Diego Pires Plentz
Fix For: 3.2.6
Error messages from Hibernate should contain sufficient amount of details to make it
possible to locate the problem.
Using hibernate in a large project is a mixed blessing. It does indeed save you from a
lot of difficult and tedious work when everything is okay, but errors during startup are
almost impossible to locate due to lack of detail. See for instance the following startup
error:
[blah, blah, blah .... could not start .... exception ...blah, blah, blah,...]
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'hibernateSessionFactory' defined in class path resource
[applicationContext-blankett.xml]: Invocation of init method failed; nested exception is
org.hibernate.HibernateException: Wrong column type: utstedt_dato, expected: date
Caused by:
org.hibernate.HibernateException: Wrong column type: utstedt_dato, expected: date
at org.hibernate.mapping.Table.validateColumns(Table.java:251)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1007)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at
org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:807)
at
org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:740)
at
org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)
at
no.bbs.common.hibernate.HibernateSessionFactoryBean.afterPropertiesSet(HibernateSessionFactoryBean.java:121)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
.....
I have 3 different hibernate datasources, 8 different *.hbm.xml files from 5 different
domain-logic modules, containing in all 9 different columns with that name. Some 15-20
people make modifications to the code base and mappings regularly. It is not so easy to
find out who to ask about this problem from the error message provided. Thanks to spring I
get an idea of which datasource that failed to start: it prints out which bean that failed
creation and where it was defined. Still, it doesn't help me to pinpoint the problem.
Why doesn't Configuration even print out which table it is trying to validate?
Spending lots of time trying to track down such errors is truly a waste. All the required
information was available inside hibernate at the time of the problem, only it wasn't
printed out to the user.
Other error messages in hibernate are sometimes poor, too, but this is probably the
worst.
At least Configuration must print out the following info:
* table name and mapped class (fully qualified name)
* column name and expected data type (as it does today)
* The URL (or, at least, file name) of the mapping file defining the "problem"
* ... or something else for other sources of mapping info (like annotations), I have no
idea what,
Also, the following should really be printed as well
* actual data type found in the schema
* datasource URL
* datasource user name
(The hibernate developers should look to tapestry for how to make deverloper-friendly
error diagnostics. A lot of bad things can be (is) said about that project and its
leaders, but at least they provide really really nice error messages that directly points
out your error so you don't have to spend hours and hours trying to analyze/guess what
and where things went wrong)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: