{"record":{"id":"9c2310ca48720600","repo":"hibernate/hibernate-orm","slug":"missing-constructor-for-type-typename","errorCode":null,"errorMessage":"Missing constructor for type '${typeName}'","messagePattern":"Missing constructor for type '(.+?)'","errorType":"exception","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":1524,"sourceCode":"\t\t\t\t(SqmPluralValuedSimplePath<?>) pluralAttributePath,\n\t\t\t\tcollectionFunctionNature( firstNode )\n\t\t);\n\t}\n\n\t@Override\n\tpublic SqmDynamicInstantiation<?> visitInstantiation(HqlParser.InstantiationContext ctx) {\n\t\tfinal var dynamicInstantiation = visitInstantiationTarget( ctx.instantiationTarget() );\n\t\tfor ( var arg : ctx.instantiationArguments().instantiationArgument() ) {\n\t\t\tdynamicInstantiation.addArgument( visitInstantiationArgument( arg ) );\n\t\t}\n\n\t\tif ( !dynamicInstantiation.checkInstantiation( creationContext.getTypeConfiguration() ) ) {\n\t\t\tfinal String typeName = dynamicInstantiation.getJavaType().getSimpleName();\n\t\t\tif ( dynamicInstantiation.isFullyAliased() ) {\n\t\t\t\tthrow new SemanticException( \"Missing constructor or attributes for injection into type '\" + typeName + \"'\", query );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new SemanticException( \"Missing constructor for type '\" + typeName  + \"'\", query );\n\t\t\t}\n\t\t}\n\n\t\treturn dynamicInstantiation;\n\t}\n\n\t@Override\n\tpublic SqmDynamicInstantiation<?> visitInstantiationTarget(HqlParser.InstantiationTargetContext ctx) {\n\t\tif ( ctx.MAP() != null ) {\n\t\t\treturn forMapInstantiation( mapJavaType, nodeBuilder() );\n\t\t}\n\t\telse if ( ctx.LIST() != null ) {\n\t\t\treturn forListInstantiation( listJavaType, nodeBuilder() );\n\t\t}\n\t\telse {\n\t\t\tfinal var simplePath = ctx.simplePath();\n\t\t\tif ( simplePath == null ) {\n\t\t\t\tthrow new SyntaxException( \"Missing instantiation target type\" );","sourceCodeStart":1506,"sourceCodeEnd":1542,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L1506-L1542","documentation":"Error \"Missing constructor for type '${typeName}'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A dynamic instantiation (select new) target cannot be constructed.","commonSituations":"Using 'select new SomeClass(...)' where the class is missing or has no matching constructor.","solutions":["Add a constructor with the required signature to the target type.","Check argument count and types of the 'new' instantiation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}