{"record":{"id":"3d59f26122d0f76d","repo":"hibernate/hibernate-orm","slug":"unable-to-determine-dialect-without-jdbc-metadata","errorCode":null,"errorMessage":"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)","messagePattern":"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\\)","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"critical","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java","lineNumber":191,"sourceCode":"\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\n\t/**\n\t * Determine the appropriate Dialect to use given the connection.\n\t *\n\t * @param resolutionInfoSource Access to DialectResolutionInfo used to resolve the Dialect.\n\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}","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jdbc/dialect/internal/DialectFactoryImpl.java#L173-L209","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\njakarta.persistence.jdbc.url is absent, hibernate.dialect absent\n# -> Unable to determine Dialect without JDBC metadata\n\n# after\n<property name=\"hibernate.dialect\" value=\"org.hibernate.dialect.PostgreSQLDialect\"/>","handlingStrategy":"validation","validationCode":"// assert bootstrap has one of the two dialect inputs before building\nboolean hasDialect = settings.get(JdbcSettings.DIALECT) != null;\nboolean hasUrl = settings.get(JdbcSettings.JAKARTA_JDBC_URL) != null;\nif ( !hasDialect && !hasUrl ) {\n    throw new ConfigurationException(\"Set hibernate.dialect or jakarta.persistence.jdbc.url\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["hibernate","dialect","configuration","bootstrap","jdbc-metadata"],"backgroundTag":"missing-dialect-configuration","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}