{"record":{"id":"d34654dc22cc6b2c","repo":"hibernate/hibernate-orm","slug":"error-calling-value-settypeusingreflection-contai","errorCode":null,"errorMessage":"Error calling Value#setTypeUsingReflection: containingClassName=[%s], propertyName=[%s], role=[%s]","messagePattern":"Error calling Value#setTypeUsingReflection: containingClassName=\\[(.+?)\\], propertyName=\\[(.+?)\\], role=\\[(.+?)\\]","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java","lineNumber":2185,"sourceCode":"\t\t\tValue value,\n\t\t\tString containingClassName,\n\t\t\tString propertyName,\n\t\t\tAttributeRole attributeRole) {\n\t\tif ( StringHelper.isEmpty( propertyName ) ) {\n\t\t\tthrow new MappingException(\n\t\t\t\t\t\"Attribute mapping must define a name attribute:\"\n\t\t\t\t\t+ \" containingClassName=[%s], propertyName=[%s], role=[%s]\"\n\t\t\t\t\t\t\t.formatted( containingClassName, propertyName,\n\t\t\t\t\t\t\t\t\tattributeRole.getFullPath() ),\n\t\t\t\t\tsourceDocument.getOrigin()\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tvalue.setTypeUsingReflection( containingClassName, propertyName );\n\t\t}\n\t\tcatch (MappingException ome) {\n\t\t\tthrow new MappingException(\n\t\t\t\t\t\"Error calling Value#setTypeUsingReflection:\"\n\t\t\t\t\t+ \" containingClassName=[%s], propertyName=[%s], role=[%s]\"\n\t\t\t\t\t\t\t.formatted( containingClassName, propertyName,\n\t\t\t\t\t\t\t\t\tattributeRole.getFullPath() ),\n\t\t\t\t\tome,\n\t\t\t\t\tsourceDocument.getOrigin()\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate void bindProperty(\n\t\t\tMappingDocument mappingDocument,\n\t\t\tAttributeSource propertySource,\n\t\t\tProperty property) {\n\t\tproperty.setName( propertySource.getName() );\n\n\t\tfinal String propertyAccessorName = propertySource.getPropertyAccessorName();\n\t\tproperty.setPropertyAccessorName( isNotEmpty( propertyAccessorName )","sourceCodeStart":2167,"sourceCodeEnd":2203,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java#L2167-L2203","documentation":"The reflection-based type resolution did run, but Value.setTypeUsingReflection(containingClassName, propertyName) threw a MappingException - typically because the named class does not exist on the classpath, has no field/getter named propertyName, or the property's Java type has no resolvable Hibernate type. The original exception is chained, so the cause carries the precise reason.","triggerScenarios":"class= pointing to a class not on the classpath; name= pointing to a field/getter that does not exist or was renamed; a property whose Java type has no registered Hibernate type and no explicit type attribute was given.","commonSituations":"Renaming a Java field without updating the mapping; mapping files referencing classes from a jar missing at runtime; custom value types needing an explicit type, UserType, or CompositeUserType that was not declared.","solutions":["Read the chained cause: ClassNotFoundException means fix class=; PropertyNotFoundException means align name= with the actual field/getter","If the Java type has no default Hibernate type, add an explicit type attribute or register a UserType/CompositeUserType","Ensure the mapped class is on the application classpath at bootstrap time"],"exampleFix":"// before\n<property name='email' column='email'/>  <!-- field renamed to emailAddress -->\n\n// after\n<property name='emailAddress' column='email'/>","handlingStrategy":"validation","validationCode":"// verify class + property exist before Hibernate reflects\nClass<?> clazz = Class.forName(mappingClassName);\nPropertyDescriptor[] props = Introspector.getBeanInfo(clazz).getPropertyDescriptors();\nboolean found = Arrays.stream(props).anyMatch(p -> p.getName().equals(propertyName) && p.getReadMethod() != null);\nif (!found) {\n    throw new IllegalStateException(\"No readable property '\" + propertyName + \"' on \" + mappingClassName);\n}","typeGuard":"static boolean hasReadableProperty(Class<?> clazz, String name) {\n    try {\n        return new PropertyDescriptor(name, clazz).getReadMethod() != null;\n    } catch (IntrospectionException e) {\n        return false;\n    }\n}","tryCatchPattern":"catch (MappingException e) during bootstrap and log getCause() - the cause distinguishes ClassNotFoundException (fix class=) from PropertyNotFoundException (align name=). Fix the mapping; retrying cannot help.","preventionTips":["Rename Java fields and mapping names in the same change","Keep mapped classes on the runtime classpath (verify with Class.forName in tests)","Specify explicit types for exotic Java types or register a UserType"],"tags":["hibernate","hbm-mapping","reflection","type-resolution","classpath"],"backgroundTag":"orm-type-resolution-failure","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}