When starting a session with an empty hibernate config:
final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
.build();
SessionFactory sessionFactory = new MetadataSources(registry)
.buildMetadata()
.buildSessionFactory();
try (Session session = sessionFactory.openSession()) {
session.beginTransaction();
session.getTransaction().commit();
}
The error that gets propagated to the user contains a cryptic message about a missing dialect:
(Complete output) A more appropriate error should inform about the main issue here - no available connection. I propose to change the dialect detection procedure to return a default dialect (aka `new Dialect() {}`) on failure and moving on. The exception that gets propagated to the user becomes:
(Complete output) Instead of returning an anonymous instance of Dialect, a new `DefaultDialect` class might be a better choice. |