When I configure hibernate to connect to a DB and for some reason the connection fails, I noticed that it doesnt throw any exception neither when building the factory (which is acceptable) nor when I call sessionFactory.openSession() (which is less acceptable). What is more annoying is that session.isConnected() returns true after I call sessionFactory.openSession(). (Which is totally unacceptable).
The only hint up to that moment that tells me that it hasnt connected to the DB is a WARN log entry caused by a java.sql.SQLException that it internally catches and just sends to the logger. Besides creating a pseudo transaction to force an exception is there any other way of getting the connection status? (Maybe an option in the configuration that says "dont log the failed connection attempt, but throw a hibernate exception) . I ve searched but not found anything. Thanks a lot.