hibernate/hibernate-orm · critical · HibernateException
Unable to determine Dialect without JDBC metadata (please…
Error message
Unable to determine Dialect without JDBC metadata (please set 'jakarta.persistence.jdbc.url' for common cases or 'hibernate.dialect' when a custom Dialect implementation must be provided)
What it means
DialectFactoryImpl.determineDialect received a null DialectResolutionInfoSource, meaning Hibernate had no live JDBC connection (hence no DatabaseMetaData) from which to auto-detect the dialect, and no explicit hibernate.dialect was set. Since dialect resolution needs one of the two inputs, bootstrap fails fast with guidance to set jakarta.persistence.jdbc.url or hibernate.dialect.
Solutions
- Set hibernate.dialect (or JPA jakarta.persistence property 'hibernate.dialect') explicitly, e.g. org.hibernate.dialect.PostgreSQLDialect
- Or provide a JDBC URL (jakarta.persistence.jdbc.url) so Hibernate can connect and auto-detect
- If connections are intentionally deferred, dialect specification is mandatory - wire it from your deployment config
- For boot-time schema tools, pass --dialect or the equivalent option
Example fix
# before jakarta.persistence.jdbc.url is absent, hibernate.dialect absent # -> Unable to determine Dialect without JDBC metadata # after <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
Defensive patterns
Strategy: validation
Validate before calling
// assert bootstrap has one of the two dialect inputs before building
boolean hasDialect = settings.get(JdbcSettings.DIALECT) != null;
boolean hasUrl = settings.get(JdbcSettings.JAKARTA_JDBC_URL) != null;
if ( !hasDialect && !hasUrl ) {
throw new ConfigurationException("Set hibernate.dialect or jakarta.persistence.jdbc.url");
} Prevention
- Always set hibernate.dialect explicitly in multi-tenant or connection-deferred setups
- Add a config-validation step (e.g. at app start) that rejects persistence configs lacking both dialect and jdbc url
When it happens
Trigger: Building a SessionFactory/EntityManagerFactory with neither hibernate.dialect nor a resolvable JDBC connection at metadata-building time - e.g. a connection provider that defers connections, schema tools invoked without a connection, or all jdbc.* properties omitted.
Common situations: Multi-tenant apps that intentionally keep no base connection; tests with an empty persistence.xml; copy-pasted configs where the dialect line was dropped during migration from hibernate.dialect to jakarta.* properties; using a custom ConnectionProvider that returns connections lazily.
Related errors
- Could not instantiate named dialect class
- Unable to construct requested dialect
- Unable to instantiate named dialect resolver
- Could not determine how to handle configuration raw
- Could not determine how to handle configuration value
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/3d59f26122d0f76d.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java:191
}
catch (Exception e) {
throw new HibernateException( "Unable to construct requested dialect [" + dialectReference + "]", e );
}
}
/**
* Determine the appropriate Dialect to use given the connection.
*
* @param resolutionInfoSource Access to DialectResolutionInfo used to resolve the Dialect.
*
* @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)