hibernate/hibernate-orm · error · SemanticException
Missing constructor or attributes for injection into type '$
Error message
Missing constructor or attributes for injection into type '${typeName}' What it means
Error "Missing constructor or attributes for injection into type '${typeName}'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:1521
}
return new SqmPluralPartSelectionPath<>(
(SqmPluralValuedSimplePath<?>) pluralAttributePath,
collectionFunctionNature( firstNode )
);
}
@Override
public SqmDynamicInstantiation<?> visitInstantiation(HqlParser.InstantiationContext ctx) {
final var dynamicInstantiation = visitInstantiationTarget( ctx.instantiationTarget() );
for ( var arg : ctx.instantiationArguments().instantiationArgument() ) {
dynamicInstantiation.addArgument( visitInstantiationArgument( arg ) );
}
if ( !dynamicInstantiation.checkInstantiation( creationContext.getTypeConfiguration() ) ) {
final String typeName = dynamicInstantiation.getJavaType().getSimpleName();
if ( dynamicInstantiation.isFullyAliased() ) {
throw new SemanticException( "Missing constructor or attributes for injection into type '" + typeName + "'", query );
}
else {
throw new SemanticException( "Missing constructor for type '" + typeName + "'", query );
}
}
return dynamicInstantiation;
}
@Override
public SqmDynamicInstantiation<?> visitInstantiationTarget(HqlParser.InstantiationTargetContext ctx) {
if ( ctx.MAP() != null ) {
return forMapInstantiation( mapJavaType, nodeBuilder() );
}
else if ( ctx.LIST() != null ) {
return forListInstantiation( listJavaType, nodeBuilder() );
}
else {View on GitHub (pinned to fad1729dce)
Solutions
- Add a constructor matching the instantiation arguments on the target type.
- Ensure the selected aliases match the constructor parameters.
When it happens
Trigger: A dynamic instantiation (select new) target cannot be constructed.
Common situations: Using 'select new SomeClass(...)' where the class is missing or has no matching constructor.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/4dce2ac881517406.
Report an issue: GitHub.