{"record":{"id":"05ef234e034e6f0a","repo":"hibernate/hibernate-orm","slug":"not-null-property-references-a-null-or-transient-v","errorCode":null,"errorMessage":"not-null property references a null or transient value","messagePattern":"not-null property references a null or transient value","errorType":"exception","errorClass":"PropertyValueException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/engine/internal/Nullability.java","lineNumber":90,"sourceCode":"\t\t\t// So setting a subcomponent as update=\"false\" has no effect on\n\t\t\t// not-null check if the main component had good checkability\n\t\t\t// In this implementation, we keep this feature.\n\t\t\t// However, I never see any documentation mentioning that, but\n\t\t\t// it's for sure a limitation.\n\n\t\t\tfinal boolean[] nullability = persister.getPropertyNullability();\n\t\t\tfinal boolean[] checkability = getCheckability( persister );\n\t\t\tfinal Type[] propertyTypes = persister.getPropertyTypes();\n\t\t\tfinal Generator[] generators = persister.getGenerators();\n\t\t\tfor ( int i = 0; i < values.length; i++ ) {\n\t\t\t\tif ( checkability[i]\n\t\t\t\t\t\t&& !unfetched( values[i] )\n\t\t\t\t\t\t&& !generated( generators[i] ) ) {\n\t\t\t\t\tfinal Object value = values[i];\n\t\t\t\t\tif ( value == null ) {\n\t\t\t\t\t\tif ( !nullability[i] ) {\n\t\t\t\t\t\t\t// check basic level-one nullability\n\t\t\t\t\t\t\tthrow new PropertyValueException(\n\t\t\t\t\t\t\t\t\t\"not-null property references a null or transient value\",\n\t\t\t\t\t\t\t\t\tpersister.getEntityName(),\n\t\t\t\t\t\t\t\t\tpersister.getPropertyNames()[i]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// values is not null and is checkable, we'll look deeper\n\t\t\t\t\t\tfinal String breakProperties = checkSubElementsNullability( propertyTypes[i], value );\n\t\t\t\t\t\tif ( breakProperties != null ) {\n\t\t\t\t\t\t\tthrow new PropertyValueException(\n\t\t\t\t\t\t\t\t\t\"not-null property references a null or transient value\",\n\t\t\t\t\t\t\t\t\tpersister.getEntityName(),\n\t\t\t\t\t\t\t\t\tqualify( persister.getPropertyNames()[i], breakProperties )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/internal/Nullability.java#L72-L108","documentation":"Error \"not-null property references a null or transient value\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/engine/internal/Nullability.java:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set a non-null, persistent value on the not-null property before flushing","Make the property nullable, or persist the referenced transient value first"],"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"}