{"record":{"id":"fa4c658791a75390","repo":"hibernate/hibernate-orm","slug":"null-value-was-assigned-to-a-property-s-s-of-p","errorCode":null,"errorMessage":"Null value was assigned to a property [%s.%s] of primitive type","messagePattern":"Null value was assigned to a property \\[(.+?)\\.(.+?)\\] of primitive type","errorType":"exception","errorClass":"PropertyAccessException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java","lineNumber":57,"sourceCode":"\t\treturn containerClass;\n\t}\n\n\tpublic String getPropertyName() {\n\t\treturn propertyName;\n\t}\n\n\tpublic Field getField() {\n\t\treturn field;\n\t}\n\n\t@Override\n\tpublic void set(Object target, @Nullable Object value) {\n\t\ttry {\n\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]\",","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java#L39-L75","documentation":"Error \"Null value was assigned to a property [%s.%s] of primitive type\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Null is assigned to a primitive-typed persistent property.","commonSituations":"Loading a nullable database column into a primitive field, or explicitly setting null on a primitive property.","solutions":["Change the primitive field to its wrapper type (e.g. Integer instead of int) if null is valid.","Ensure the database column is NOT NULL or provide a default value."],"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"}