{"record":{"id":"8f7a5e428f105f3f","repo":"hibernate/hibernate-orm","slug":"couldn-t-load-the-dialect-class-for-the-hibernate","errorCode":null,"errorMessage":"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/","messagePattern":"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/","errorType":"exception","errorClass":"StrategySelectionException","httpStatus":null,"severity":"critical","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java","lineNumber":160,"sourceCode":"\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}\n\t\t\tthrow e;\n\t\t}\n\t\tcatch (HibernateException e) {\n\t\t\tthrow e;\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new HibernateException( \"Unable to construct requested dialect [\" + dialectReference + \"]\", e );\n\t\t}\n\t}\n","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java#L142-L178","documentation":"Loading the dialect class named by hibernate.dialect failed, and its FQN is in Hibernate's LEGACY_DIALECTS list - dialects for database versions vendors no longer support, which were moved out of hibernate-core into the hibernate-community-dialects module in Hibernate 6.2. The fix-oriented message tells you to add that artifact; the original StrategySelectionException is chained.","triggerScenarios":"hibernate.dialect references a legacy dialect class (older MySQL/MariaDB/DB2/etc. versions whose classes moved to org.hibernate.community.dialect) while org.hibernate.orm:hibernate-community-dialects is not on the runtime classpath.","commonSituations":"Upgrading Hibernate 5.x/6.0/6.1 to 6.2+ while keeping an old dialect class name; staying on an EOL database version (MySQL 5.5/5.7, old MariaDB) after the 6.2 support cut; WARs assembled without the community dialects jar.","solutions":["Add the dependency: org.hibernate.orm:hibernate-community-dialects (same version as hibernate-core)","Better long-term: upgrade the database to a vendor-supported version and switch to the corresponding supported dialect","Alternatively implement a custom Dialect extending the closest supported one for the legacy database","Check the chained cause to confirm it is a ClassNotFound-style failure for the legacy class"],"exampleFix":"# before (ClassNotFoundException wrapped in StrategySelectionException)\nhibernate.dialect=org.hibernate.dialect.MySQL57Dialect\n\n# after: add the artifact (Maven)\n<dependency>\n  <groupId>org.hibernate.orm</groupId>\n  <artifactId>hibernate-community-dialects</artifactId>\n  <version>${hibernate.version}</version>\n</dependency>\n# and use the relocated class name\nhibernate.dialect=org.hibernate.community.dialect.MySQL57Dialect","handlingStrategy":"validation","validationCode":"// fail with a clear message at startup instead of during EMF build\ntry {\n    Class.forName(\"org.hibernate.community.dialect.CommunityDialect\", false, getClass().getClassLoader());\n} catch (ClassNotFoundException e) {\n    throw new IllegalStateException(\n        \"Legacy dialects require org.hibernate.orm:hibernate-community-dialects on the classpath\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When upgrading across Hibernate 6.2+, scan configs for dialect classes now living in hibernate-community-dialects and add the artifact","Track database end-of-life dates; community dialects are a stopgap, not a destination"],"tags":["hibernate","dialect","classloading","maven","upgrade","legacy"],"backgroundTag":"missing-module-dependency","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}