Hibernate property hibernate.dialect_resolvers let specify custom Dialect resolvers if no hibernate.dialect is set. I cannot get the property to work with Spring Data JPA and debugging I've found what I guess is the issue, i.e. HibernateJpaVendorAdapter at Line 130 always sets the dialect property and doing so Hibernate will not take into account the dialect_resolvers property.
What’s the purpose of the else branch at all? If the dialect isn’t set by the user, Hibernate’s already has its own default resolver that will select the right one, even more precisely than this (which just returns the latest dialect class, without checking the database version).
So you are setting the "database" property on HibernateJpaVendorAdapter but do not want the dialect to be directly derived from it? Could you simply drop that property since that's pretty much its sole purpose in HibernateJpaVendorAdapter? In case of Database.DEFAULT, no Hibernate property is going to be set since determineDatabaseDialectClass will return null, which in turn means that Hibernate's standard dialect resolution mechanism kicks in.
The workaround I'm using now is to specify also hibernate.dialect: # empty so that the property set by Spring will be overwritten with an empty string and Hibernate will ignore that, triggering the resolvers. It works but it's very counter-intuitive and I needed a lot of debugging to figure it out.
From a Spring Framework perspective, this is essentially a documentation issue for anybody configuring HibernateJpaVendorAdapter directly. Let's repurpose this ticket for an explicit note about HibernateJpaVendorAdapter.setDatabase vs hibernate.dialect_resolvers, clarifying that they are mutually exclusive.