hibernate/hibernate-orm · error · ConnectionProviderConfigurationException
Could not configure c3p0: " + e.getMessage()
Error message
Could not configure c3p0: " + e.getMessage()
What it means
getSortExpressions(...) reads the select-item indexes recorded on the SortSpecification when the SQL AST node was built. This IllegalStateException is a defensive internal check claiming the indexes array is null; in the current code the field is final and always computed in the constructor from the sort expression, so a null can only come from a hand-built or mutated SortSpecification outside the normal SQM-to-SQL pipeline. Treat it as framework-internal corruption, not a query-authoring mistake.
Source
Thrown at hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0ConnectionProvider.java:232
DEFAULT_MAX_POOL_SIZE ),
fetchSize
);
if ( !connection.getAutoCommit() ) {
connection.rollback();
}
}
catch (SQLException e) {
throw new JDBCConnectionException( "Could not create connection", e );
}
}
private DataSource createDataSource(String jdbcUrl, Properties connectionProps, Map<String, Object> poolProperties) {
try {
return pooledDataSource( unpooledDataSource( jdbcUrl, connectionProps ), poolProperties );
}
catch (Exception e) {
CONNECTION_INFO_LOGGER.unableToInstantiateConnectionPool( e );
throw new ConnectionProviderConfigurationException(
"Could not configure c3p0: " + e.getMessage(), e );
}
}
private void loadDriverClass(String jdbcDriverClass) {
if ( jdbcDriverClass == null ) {
CONNECTION_INFO_LOGGER.jdbcDriverNotSpecified();
}
else {
try {
serviceRegistry.requireService( ClassLoaderService.class ).classForName( jdbcDriverClass );
}
catch (ClassLoadingException e) {
throw new ClassLoadingException( "JDBC Driver class " + jdbcDriverClass + " not found", e );
}
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Upgrade Hibernate - the indexes contract changed across 6.x/7.x and bugs here get fixed.
- If you build SortSpecification yourself, construct it from an expression that wraps a SqlSelectionExpression so indexes are derived, or via the public constructors only.
- Avoid mutating SQL AST nodes after the translator receives them.
- Report to HHH with the stack trace if no custom AST code is involved.
Defensive patterns
Strategy: try-catch
Try / catch
try {
return query.getResultList();
} catch ( IllegalStateException e ) {
if ( e.getMessage() != null && e.getMessage().contains("missing selection indexes") ) {
// framework-internal: capture mapping + query and file an HHH issue
logHibernateIssue( e, currentQuery );
throw e;
}
throw e;
} Prevention
- Do not mutate or hand-construct SortSpecification/SQL AST nodes after handing a query to Hibernate.
- Keep SQL-AST rewriting extensions in sync with each Hibernate upgrade.
- Isolate custom AST manipulations behind integration tests that run the translated SQL.
When it happens
Trigger: Custom code constructing SortSpecification subclasses or replacing sort expressions after construction and then running the query through full-join emulation (MySQL/MariaDB/Sybase/H2/TiDB); reflection-based mutation; a Hibernate regression where a SortSpecification is created without a SqlSelectionExpression-based expression.
Common situations: Extensions that post-process the SQL AST (custom translators, auditing/rewriting layers); version upgrades that changed SortSpecification constructors; rarely, users building native SQL AST by hand.
Related errors
- JDBC Driver class " + jdbcDriverClass + " not found
- Could not create connection
- Could not create connection
- Summarization is not supported by DBMS!
- unrecognized field: " + unit
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/937384fef9a63053.
Report an issue: GitHub.