[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2233) Rethrow HibernateException instead of "catch and log only" SQLException.

Mark Gorokhov (JIRA) noreply at atlassian.com
Sat Nov 11 20:07:04 EST 2006


Rethrow HibernateException instead of "catch and log only" SQLException.
------------------------------------------------------------------------

         Key: HHH-2233
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2233
     Project: Hibernate3
        Type: Improvement

  Components: core  
    Versions: 3.2.0.ga    
 Environment: Hibernate v 3.2.0, October 16, 2006,
HSQLDB 1.8.0.7 (Using In-process mode)
    Reporter: Mark Gorokhov


Steps to reproduce:
AnnotationConfiguration ac = new AnnotationConfiguration();
ac.addAnnotatedClass(Foo.class); // with annotations
ac.setProperty(Environment.URL, "jdbc:hsqldb:file:C:\\abc\\dbTest");
ac.setProperty(Environment.DRIVER, "org.hsqldb.jdbcDriver");
ac.setProperty(Environment.USER, "wrong_user"); // note: not "sa" user
ac.setProperty(Environment.PASS, "bad");
ac.setProperty(Environment.DIALECT, "org.hibernate.dialect.HSQLDialect");
ac.setProperty(Environment.CACHE_PROVIDER,"org.hibernate.cache.NoCacheProvider");
ac.setProperty(Environment.HBM2DDL_AUTO, "update"); // creates missing DB
SessionFactory sessionFactory = ac.buildSessionFactory(); 

There are *logged* SQLExceptions "User not found" but ac.buildSessionFactory() does not *throw* any exceptions. SessionFactory is not functional but there are no exceptions thrown!

Probably there are other places in the code when exception is logged but not rethrown. Exception in a log is useless because client code does not know about exception and does not report problem to a user and does not make attempts to recover.


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