{"record":{"id":"319c7977ee5628b5","repo":"hibernate/hibernate-orm","slug":"jdbc-driver-class-jdbcdriverclass-not-foun","errorCode":null,"errorMessage":"JDBC Driver class \" + jdbcDriverClass + \" not found","messagePattern":"JDBC Driver class \" \\+ jdbcDriverClass \\+ \" not found","errorType":"exception","errorClass":"ClassLoadingException","httpStatus":null,"severity":"error","filePath":"hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0ConnectionProvider.java","lineNumber":246,"sourceCode":"\t\t\treturn pooledDataSource( unpooledDataSource( jdbcUrl, connectionProps ), poolProperties );\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tCONNECTION_INFO_LOGGER.unableToInstantiateConnectionPool( e );\n\t\t\tthrow new ConnectionProviderConfigurationException(\n\t\t\t\t\t\"Could not configure c3p0: \" + e.getMessage(),  e );\n\t\t}\n\t}\n\n\tprivate void loadDriverClass(String jdbcDriverClass) {\n\t\tif ( jdbcDriverClass == null ) {\n\t\t\tCONNECTION_INFO_LOGGER.jdbcDriverNotSpecified();\n\t\t}\n\t\telse {\n\t\t\ttry {\n\t\t\t\tserviceRegistry.requireService( ClassLoaderService.class ).classForName( jdbcDriverClass );\n\t\t\t}\n\t\t\tcatch (ClassLoadingException e) {\n\t\t\t\tthrow new ClassLoadingException( \"JDBC Driver class \" + jdbcDriverClass + \" not found\", e );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate Map<String, Object> poolSettings(Map<String, Object> hibernateProperties) {\n\t\t//swaldman 2004-02-07: modify to allow null values to signify fall through to c3p0 PoolConfig defaults\n\t\tInteger maxPoolSize = getInteger( C3P0_MAX_SIZE, hibernateProperties );\n\t\tif ( maxPoolSize == null ) {\n\t\t\t// if hibernate.c3p0.max_size is not specified, use hibernate.connection.pool_size\n\t\t\tmaxPoolSize = getInteger( JdbcSettings.POOL_SIZE, hibernateProperties );\n\t\t}\n\t\tfinal Integer minPoolSize = getInteger( C3P0_MIN_SIZE, hibernateProperties );\n\t\tfinal Integer maxIdleTime = getInteger( C3P0_TIMEOUT, hibernateProperties );\n\t\tfinal Integer maxStatements = getInteger( C3P0_MAX_STATEMENTS, hibernateProperties );\n\t\tfinal Integer acquireIncrement = getInteger( C3P0_ACQUIRE_INCREMENT, hibernateProperties );\n\t\tfinal Integer idleTestPeriod = getInteger( C3P0_IDLE_TEST_PERIOD, hibernateProperties );\n\n\t\tfinal Map<String,Object> c3p0Properties = new HashMap<>();","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0ConnectionProvider.java#L228-L264","documentation":"When ordering a union-emulated full join, Hibernate compares the number of select-item indexes recorded for a SortSpecification with the component count of the sort expression (a plain expression counts as 1; a SqlTuple counts as its parts, e.g. a composite key). This IllegalStateException fires when the tuple size changed after the indexes were computed - the constructor derives indexes from the same expression, so a mismatch implies the expression graph was rewritten between construction and rendering. It is an internal-invariant failure, typically a framework bug.","triggerScenarios":"ORDER BY a composite expression (embedded id, @EmbeddedId, composite fk, tuple from a derived select) in a full-join query on an emulating dialect, where translation replaced the SqlTuple (e.g. tuple re-wrapping or expression substitution during emulation branch creation) so lengths diverge.","commonSituations":"Sorting by a whole embedded/composite value of the full-joined entity on MySQL/MariaDB; queries that worked on earlier 6.x versions regressing after an upgrade to 7.x emulation changes.","solutions":["Order by the explicit component paths instead of the composite as a whole (e.g. order by id.part1, id.part2).","Upgrade to the latest Hibernate 7.x point release - emulation tuple handling is actively fixed.","Avoid the full join for composite-key ordering, or sort in a wrapping outer query.","Report an HHH issue including the entity mapping with the composite id and the full join query."],"exampleFix":"// before: ordering by the whole embedded id\n\"select a, b from A a full join a.bs b order by b.id\"\n\n// after: order by the tuple components explicitly\n\"select a, b from A a full join a.bs b order by b.id.part1, b.id.part2\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return query.getResultList();\n} catch ( IllegalStateException e ) {\n    if ( e.getMessage() != null && e.getMessage().contains(\"selection indexes size mismatch\") ) {\n        // order by composite components explicitly instead of the tuple as a whole\n        return em.createQuery(expandCompositeOrderBy(hql), type).getResultList();\n    }\n    throw e;\n}","preventionTips":["Order by the explicit components of embedded/composite keys rather than the composite value as one item.","Regression-test full-join + composite-key ordering on emulating dialects after every Hibernate upgrade.","Pin a known-good Hibernate version once composite ordering works in your suite."],"tags":["internal","sort","composite-key","full-join","sql-ast"],"backgroundTag":"sql-ast-internal-invariant","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}