{"record":{"id":"864daa8c326de841","repo":"hibernate/hibernate-orm","slug":"unable-to-determine-dialect-for-databasename-ma","errorCode":null,"errorMessage":"Unable to determine Dialect for <databaseName> <majorVersion>.<minorVersion> (please set 'hibernate.dialect' or register a Dialect resolver)","messagePattern":"Unable to determine Dialect for <databaseName> <majorVersion>\\.<minorVersion> \\(please set 'hibernate\\.dialect' or register a Dialect resolver\\)","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"critical","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java","lineNumber":201,"sourceCode":"\t *\n\t * @return The appropriate dialect instance.\n\t *\n\t * @throws HibernateException No connection given or no resolver could make\n\t * the determination from the given connection.\n\t */\n\tprivate Dialect determineDialect(DialectResolutionInfoSource resolutionInfoSource) {\n\t\tif ( resolutionInfoSource == null ) {\n\t\t\tthrow new HibernateException(\n\t\t\t\t\t\"Unable to determine Dialect without JDBC metadata \"\n\t\t\t\t\t+ \"(please set '\" + JdbcSettings.JAKARTA_JDBC_URL + \"' for common cases or '\" + JdbcSettings.DIALECT + \"' when a custom Dialect implementation must be provided)\"\n\t\t\t);\n\t\t}\n\n\t\tfinal DialectResolutionInfo info = resolutionInfoSource.getDialectResolutionInfo();\n\t\tfinal Dialect dialect = dialectResolver.resolveDialect( info );\n\n\t\tif ( dialect == null ) {\n\t\t\tthrow new HibernateException(\n\t\t\t\t\t\"Unable to determine Dialect for \" + info.getDatabaseName() + \" \"\n\t\t\t\t\t+ info.getDatabaseMajorVersion() + \".\" + info.getDatabaseMinorVersion()\n\t\t\t\t\t+ \" (please set 'hibernate.dialect' or register a Dialect resolver)\"\n\t\t\t);\n\t\t}\n\n\t\treturn dialect;\n\t}\n}\n","sourceCodeStart":183,"sourceCodeEnd":211,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java#L183-L211","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set hibernate.dialect explicitly to the closest supported dialect for your database family","Upgrade Hibernate ORM to a release that supports your database version","Register a custom DialectResolver via hibernate.dialect_resolvers or META-INF/services that handles the version","Add hibernate-community-dialects if the version is only community-supported"],"exampleFix":"# before: PostgreSQL 18 on an ORM release that resolves up to 17\n# -> Unable to determine Dialect for PostgreSQL 18.1\n\n# after\n<property name=\"hibernate.dialect\" value=\"org.hibernate.dialect.PostgreSQLDialect\"/>","handlingStrategy":"fallback","validationCode":"// pre-check: can this Hibernate build resolve the running database?\ntry (Connection c = dataSource.getConnection()) {\n    DatabaseMetaData meta = c.getMetaData();\n    // attempt resolution via a scratch registry or log db name/version and compare\n    // against the dialects shipped in your Hibernate version\n}","typeGuard":null,"tryCatchPattern":"try {\n    return buildSessionFactory(originalSettings);\n} catch (HibernateException e) {\n    if ( e.getMessage() != null && e.getMessage().startsWith(\"Unable to determine Dialect for\") ) {\n        Map<String,Object> fixed = new HashMap<>(originalSettings);\n        fixed.put(AvailableSettings.DIALECT, defaultDialectForThisFamily);\n        return buildSessionFactory(fixed); // retry with pinned dialect\n    }\n    throw e;\n}","preventionTips":["Pin hibernate.dialect in every environment instead of relying on auto-detection","When adopting a new database version, verify the Hibernate release train supports it before upgrading the DB"],"tags":["hibernate","dialect","database-version","bootstrap","auto-detection"],"backgroundTag":"unsupported-database-version","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}