{"record":{"id":"a534e2a6984c661e","repo":"hibernate/hibernate-orm","slug":"unable-to-construct-requested-dialect-dialectref","errorCode":null,"errorMessage":"Unable to construct requested dialect [<dialectReference>]","messagePattern":"Unable to construct requested dialect \\[<dialectReference>\\]","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"critical","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java","lineNumber":150,"sourceCode":"\t\t\t\t\t\t\t\t\t\t\tresolutionInfoSource.getDialectResolutionInfo()\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (NoSuchMethodException nsme) {\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn dialectClass.newInstance();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (InstantiationException | IllegalAccessException | InvocationTargetException e) {\n\t\t\t\t\t\t\tthrow new StrategySelectionException(\n\t\t\t\t\t\t\t\t\tString.format( \"Could not instantiate named dialect class [%s]\", dialectClass.getName() ),\n\t\t\t\t\t\t\t\t\te\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t);\n\t\t\tif ( dialect == null ) {\n\t\t\t\tthrow new HibernateException( \"Unable to construct requested dialect [\" + dialectReference + \"]\" );\n\t\t\t}\n\t\t\telse if ( Dialect.class.getPackage() == dialect.getClass().getPackage() ) {\n\t\t\t\tDEPRECATION_LOGGER.automaticDialect( dialect.getClass().getSimpleName() );\n\t\t\t}\n\t\t\treturn dialect;\n\t\t}\n\t\tcatch (StrategySelectionException e) {\n\t\t\tfinal String dialectFqn = dialectReference.toString();\n\t\t\tif ( LEGACY_DIALECTS.contains( dialectFqn ) ) {\n\t\t\t\tthrow new StrategySelectionException(\n\t\t\t\t\t\t\"Couldn't load the dialect class for the 'hibernate.dialect' [\" + dialectFqn + \"], \" +\n\t\t\t\t\t\t\t\t\"because the application is missing a dependency on the hibernate-community-dialects module. \" +\n\t\t\t\t\t\t\t\t\"Hibernate 6.2 dropped support for database versions that are unsupported by vendors  \" +\n\t\t\t\t\t\t\t\t\"and code for old versions was moved to the hibernate-community-dialects module. \" +\n\t\t\t\t\t\t\t\t\"For further information, read https://in.relation.to/2023/02/15/hibernate-orm-62-db-version-support/\",\n\t\t\t\t\t\te\n\t\t\t\t);\n\t\t\t}","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java#L132-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the fully-qualified class name of the dialect in hibernate.dialect instead of a short name","Audit custom StrategySelectorContributor / service contributions that map the name you use, and ensure they register a concrete Dialect class","Run with the exact same config and print serviceRegistry.requireService(StrategySelector.class).resolveStrategy(...) to see what mapping is hit"],"exampleFix":"# before\nhibernate.dialect=mydb   # registered alias that resolves to null\n\n# after\nhibernate.dialect=org.hibernate.dialect.PostgreSQLDialect","handlingStrategy":"validation","validationCode":"// resolve the name through the same strategy selector before bootstrap\nclass ForName implements DialectReference { ... }\nDialect d = serviceRegistry.requireService(StrategySelector.class)\n        .resolveStrategy(Dialect.class, dialectReference);\nif ( d == null ) throw new ConfigurationException(\"hibernate.dialect resolves to no strategy: \" + dialectReference);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer fully-qualified dialect class names over short names in production configs","Smoke-test custom StrategySelectorContributor mappings right after service-registry build"],"tags":["hibernate","dialect","strategy-selector","bootstrap","configuration"],"backgroundTag":"unknown-dialect","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}