hibernate/hibernate-orm · error · SemanticException
Missing constructor for type '${typeName}'
Error message
Missing constructor for type '${typeName}' What it means
Error "Missing constructor for type '${typeName}'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:1524
(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 {
final var simplePath = ctx.simplePath();
if ( simplePath == null ) {
throw new SyntaxException( "Missing instantiation target type" );View on GitHub (pinned to fad1729dce)
Solutions
- Add a constructor with the required signature to the target type.
- Check argument count and types of the 'new' instantiation.
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/9c2310ca48720600.
Report an issue: GitHub.