[hibernate-dev] Wrong JdbcServicesImpl configuration with problematic connection

Dmitry Geraskov dgeraskov at exadel.com
Mon Jun 6 06:01:04 EDT 2011


Hey, guys,

I decided to write to this list to force this mistake to be fixed in Beta1.

There is a widely used class JdbcServicesImpl in hibernate4.
In the configure(Map configValues) it gets Connection object and does 
the configuration. But what if the connection can't be established? It 
do some steps in case of SQLException. But there are could be other 
reasons of connection problem. For example missing 
Driver(ClassNotFoundException), but this exception isn't handled. Why I 
think it should be handled here?

Look at SchemaExport. It has an option "export" to database. And in case 
this option is set to false we don't need the connection and Driver to 
make it generate schema script successfully. But we still need some 
configuration data from JdbcServices.  And actually in hibernate 3 it 
works nice without db connection. I guess it also would work in 
hibernate4 too, but only if connection can't be established because of 
SQLException, but not any other problem.

Dmitry Geraskov




More information about the hibernate-dev mailing list