hibernate/hibernate-orm · critical · HibernateException

Unable to determine Dialect for <databaseName> <majorVersion

Error message

Unable to determine Dialect for <databaseName> <majorVersion>.<minorVersion> (please set 'hibernate.dialect' or register a Dialect resolver)

What it means

A JDBC connection was available and its metadata read, but no registered DialectResolver recognized the reported database 'name major.minor' - DialectResolver.resolveDialect(info) returned null. Hibernate therefore cannot pick a dialect automatically for this exact database and version, and asks you to pin hibernate.dialect or register a resolver that handles it.

Source

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

	 *
	 * @return The appropriate dialect instance.
	 *
	 * @throws HibernateException No connection given or no resolver could make
	 * the determination from the given connection.
	 */
	private Dialect determineDialect(DialectResolutionInfoSource resolutionInfoSource) {
		if ( resolutionInfoSource == null ) {
			throw new HibernateException(
					"Unable to determine Dialect without JDBC metadata "
					+ "(please set '" + JdbcSettings.JAKARTA_JDBC_URL + "' for common cases or '" + JdbcSettings.DIALECT + "' when a custom Dialect implementation must be provided)"
			);
		}

		final DialectResolutionInfo info = resolutionInfoSource.getDialectResolutionInfo();
		final Dialect dialect = dialectResolver.resolveDialect( info );

		if ( dialect == null ) {
			throw new HibernateException(
					"Unable to determine Dialect for " + info.getDatabaseName() + " "
					+ info.getDatabaseMajorVersion() + "." + info.getDatabaseMinorVersion()
					+ " (please set 'hibernate.dialect' or register a Dialect resolver)"
			);
		}

		return dialect;
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Set hibernate.dialect explicitly to the closest supported dialect for your database family
  2. Upgrade Hibernate ORM to a release that supports your database version
  3. Register a custom DialectResolver via hibernate.dialect_resolvers or META-INF/services that handles the version
  4. Add hibernate-community-dialects if the version is only community-supported

Example fix

# before: PostgreSQL 18 on an ORM release that resolves up to 17
# -> Unable to determine Dialect for PostgreSQL 18.1

# after
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
Defensive patterns

Strategy: fallback

Validate before calling

// pre-check: can this Hibernate build resolve the running database?
try (Connection c = dataSource.getConnection()) {
    DatabaseMetaData meta = c.getMetaData();
    // attempt resolution via a scratch registry or log db name/version and compare
    // against the dialects shipped in your Hibernate version
}

Try / catch

try {
    return buildSessionFactory(originalSettings);
} catch (HibernateException e) {
    if ( e.getMessage() != null && e.getMessage().startsWith("Unable to determine Dialect for") ) {
        Map<String,Object> fixed = new HashMap<>(originalSettings);
        fixed.put(AvailableSettings.DIALECT, defaultDialectForThisFamily);
        return buildSessionFactory(fixed); // retry with pinned dialect
    }
    throw e;
}

Prevention

When it happens

Trigger: The database reports a name/version combination outside every built-in resolver - a database newer than the Hibernate release (e.g. PostgreSQL 18 on ORM 6.4), an old/community-supported version, or an exotic database with no built-in dialect.

Common situations: Running a brand-new database server version with an older Hibernate; Firebird/Informix/etc. handled only by community dialects; upgrades of MariaDB/MySQL to versions whose mapping tables lag behind; custom resolvers not being loaded.

Related errors


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