hibernate/hibernate-orm · critical · HibernateException

Unable to construct requested dialect [<dialectReference>]

Error message

Unable to construct requested dialect [<dialectReference>]

What it means

DialectFactoryImpl asked the strategy selector to build an instance for the configured dialect reference and got null back instead of a Dialect. The reference resolved to something (otherwise a different error would appear) but produced no instance - typically a short name mapped to a strategy that yields null, or a custom DialectReference implementation returning null.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java:150

											resolutionInfoSource.getDialectResolutionInfo()
									);
								}
							}
							catch (NoSuchMethodException nsme) {

							}
							return dialectClass.newInstance();
						}
						catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
							throw new StrategySelectionException(
									String.format( "Could not instantiate named dialect class [%s]", dialectClass.getName() ),
									e
							);
						}
					}
			);
			if ( dialect == null ) {
				throw new HibernateException( "Unable to construct requested dialect [" + dialectReference + "]" );
			}
			else if ( Dialect.class.getPackage() == dialect.getClass().getPackage() ) {
				DEPRECATION_LOGGER.automaticDialect( dialect.getClass().getSimpleName() );
			}
			return dialect;
		}
		catch (StrategySelectionException e) {
			final String dialectFqn = dialectReference.toString();
			if ( LEGACY_DIALECTS.contains( dialectFqn ) ) {
				throw new StrategySelectionException(
						"Couldn't load the dialect class for the 'hibernate.dialect' [" + dialectFqn + "], " +
								"because the application is missing a dependency on the hibernate-community-dialects module. " +
								"Hibernate 6.2 dropped support for database versions that are unsupported by vendors  " +
								"and code for old versions was moved to the hibernate-community-dialects module. " +
								"For further information, read https://in.relation.to/2023/02/15/hibernate-orm-62-db-version-support/",
						e
				);
			}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use the fully-qualified class name of the dialect in hibernate.dialect instead of a short name
  2. Audit custom StrategySelectorContributor / service contributions that map the name you use, and ensure they register a concrete Dialect class
  3. Run with the exact same config and print serviceRegistry.requireService(StrategySelector.class).resolveStrategy(...) to see what mapping is hit

Example fix

# before
hibernate.dialect=mydb   # registered alias that resolves to null

# after
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Defensive patterns

Strategy: validation

Validate before calling

// resolve the name through the same strategy selector before bootstrap
class ForName implements DialectReference { ... }
Dialect d = serviceRegistry.requireService(StrategySelector.class)
        .resolveStrategy(Dialect.class, dialectReference);
if ( d == null ) throw new ConfigurationException("hibernate.dialect resolves to no strategy: " + dialectReference);

Prevention

When it happens

Trigger: hibernate.dialect is a short name or DialectReference whose strategy-selector contribution builds null - e.g. a StrategySelectorContributor registering a name without a usable implementation class, or dialect-reference services that conditionally return null.

Common situations: Custom strategy-selector contributions (Quarkus-style) with broken mappings; using an alias that exists but is registered against a null class; typo that collides with a registered-but-empty strategy.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/a534e2a6984c661e. Report an issue: GitHub.