{"record":{"id":"320424d687b4b3ce","repo":"hibernate/hibernate-orm","slug":"could-not-set-value-of-type-s","errorCode":null,"errorMessage":"Could not set value of type [%s]","messagePattern":"Could not set value of type \\[(.+?)\\]","errorType":"exception","errorClass":"PropertyAccessException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java","lineNumber":71,"sourceCode":"\t\t\tfield.set( target, value );\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tif ( value == null && field.getType().isPrimitive() ) {\n\t\t\t\tthrow new PropertyAccessException(\n\t\t\t\t\t\te,\n\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\t\"Null value was assigned to a property [%s.%s] of primitive type\",\n\t\t\t\t\t\t\t\tcontainerClass,\n\t\t\t\t\t\t\t\tpropertyName\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tcontainerClass,\n\t\t\t\t\t\tpropertyName\n\t\t\t\t);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new PropertyAccessException(\n\t\t\t\t\t\te,\n\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\t\"Could not set value of type [%s]\",\n\t\t\t\t\t\t\t\ttypeName( value )\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tcontainerClass,\n\t\t\t\t\t\tpropertyName\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static String typeName(@Nullable Object value) {\n\t\tfinal var lazyInitializer = extractLazyInitializer( value );\n\t\tif ( lazyInitializer != null ) {\n\t\t\treturn lazyInitializer.getEntityName();","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java#L53-L89","documentation":"Error \"Could not set value of type [%s]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Ensure the value type matches the field type or register an appropriate converter.","Check the JDBC type mapping for the column."],"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"}