{"record":{"id":"9a5a931aa155fdcf","repo":"hibernate/hibernate-orm","slug":"could-not-create-connection","errorCode":null,"errorMessage":"Could not create connection","messagePattern":"Could not create connection","errorType":"exception","errorClass":"JDBCConnectionException","httpStatus":null,"severity":"error","filePath":"hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java","lineNumber":204,"sourceCode":"\t\t\t\t\thasCatalog( connection ),\n\t\t\t\t\tgetSchema( connection ),\n\t\t\t\t\tgetCatalog( connection ),\n\t\t\t\t\tBoolean.toString( connectionConfig.autoCommit() ),\n\t\t\t\t\tconnectionConfig.jdbcTransactionIsolation() != null\n\t\t\t\t\t\t&& connectionConfig.jdbcTransactionIsolation().isDefined()\n\t\t\t\t\t\t\t? toIsolationNiceName( connectionConfig.jdbcTransactionIsolation().level() )\n\t\t\t\t\t\t\t: toIsolationNiceName( getIsolation( connection ) ),\n\t\t\t\t\tpoolConfig.minSize(),\n\t\t\t\t\tpoolConfig.maxSize(),\n\t\t\t\t\tgetFetchSize( connection )\n\t\t\t);\n\t\t\tif ( !connection.getAutoCommit() ) {\n\t\t\t\tconnection.rollback();\n\t\t\t}\n\t\t\treturn info;\n\t\t}\n\t\tcatch (SQLException e) {\n\t\t\tthrow new JDBCConnectionException( \"Could not create connection\", e );\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean isUnwrappableAs(@Nonnull Class<?> unwrapType) {\n\t\treturn unwrapType.isAssignableFrom( AgroalConnectionProvider.class )\n\t\t\t|| unwrapType.isAssignableFrom( AgroalDataSource.class );\n\t}\n\n\t@Override\n\t@SuppressWarnings( \"unchecked\" )\n\tpublic <T> T unwrap(@Nonnull Class<T> unwrapType) {\n\t\tif ( unwrapType.isAssignableFrom( AgroalConnectionProvider.class ) ) {\n\t\t\treturn (T) this;\n\t\t}\n\t\telse if ( unwrapType.isAssignableFrom( AgroalDataSource.class ) ) {\n\t\t\treturn (T) agroalDataSource;\n\t\t}","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java#L186-L222","documentation":"To emulate a full join as a UNION, Hibernate must build nullness predicates ('this side was matched') from the columns of the joined side, so it reduces the joined ModelPart to something column-backed: an identifier mapping, an entity identifier, a plural-attribute key, or any ValuedModelPart. This error means the joined part is of a kind that exposes no selectable columns, so the null-check branch of the emulation cannot be rendered. It signals an exotic or unsupported mapping rather than a malformed query.","triggerScenarios":"A full join whose joined model part cannot be reduced to a ValuedModelPart in getValuedModelPart(...): not a mapping type with identifier, not an EntityValuedModelPart, not a PluralAttributeMapping, and not a ValuedModelPart - e.g. certain virtual/container model parts produced by custom persister, custom mapping types, or unusual embeddable/id mappings, on the full-join-emulating dialects.","commonSituations":"Custom MappingType/Persister implementations or dialect extensions after a Hibernate upgrade changed the model-part hierarchy; joining an association whose target uses a non-standard mapped type; experimental full join support combined with virtual id embeddings.","solutions":["Full join a regular entity association or plural attribute that is column-backed instead of the exotic path.","Restructure the query as an explicit union of left join and right join so no emulation nullness predicate is needed.","Upgrade to the latest Hibernate 7.x - model-part coverage of this helper may have been extended.","If it persists, report to Hibernate (HHH) with the mapping that produced the part name in the message."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return em.createQuery(hql, type).getResultList();\n} catch ( UnsupportedOperationException e ) {\n    if ( e.getMessage() != null && e.getMessage().startsWith(\"Full join emulation requires a table group\") ) {\n        // fall back to explicit union of left join + right join\n        return runManualFullJoin( hql );\n    }\n    throw e;\n}","preventionTips":["Full-join only regular entity associations and plural attributes on emulating dialects.","Keep custom persister/mapping-type code aligned with the current Hibernate version's ModelPart hierarchy.","Cover full-join queries with tests on the target dialect before relying on them."],"tags":["full-join","mapping","model-part","internal","dialect-limitation"],"backgroundTag":"full-join-emulation","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}