By default, JdbcServicesImpl will try to get a connection to the database to retrieve the metadata used to configure/determine the Dialect.
It may happen the JdbcServicesImpl gets a connection from the underlying provider but gets an exception when trying to use it. For instance, the connection may be obtained from a pool that doesn't validate the connection state properly...
If that happens, Hibernate logs a message saying "Could not obtain connection metadata" but will not revert to the default strategy it would have followed if no connection was available at the first place.
This leads to a NullPointerException being thrown a bit later when the dialect member field is accessed...
The point here is the JdbcServicesImpl should probably be safer when reading metadata and treat any connection-related errors as-if it never got a connection at all.
|