{"record":{"id":"36c9947294e10a7e","repo":"hibernate/hibernate-orm","slug":"null-key-for-collection-36c994","errorCode":null,"errorMessage":"null key for collection: {}","messagePattern":"null key for collection: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/persister/collection/mutation/AuditCollectionRowMutationHelper.java","lineNumber":62,"sourceCode":"\t\tthis.auditTableName = auditTableName;\n\t\tthis.changesetIdMapping = changesetIdMapping;\n\t\tthis.modificationTypeMapping = modificationTypeMapping;\n\t\tthis.indexColumnIsSettable = indexColumnIsSettable;\n\t\tthis.elementColumnIsSettable = elementColumnIsSettable;\n\t\tthis.indexIncrementer = indexIncrementer;\n\t\tthis.useServerTransactionTimestamps = useServerTransactionTimestamps;\n\t}\n\n\tvoid bindInsertValues(\n\t\t\tPersistentCollection<?> collection,\n\t\t\tObject key,\n\t\t\tObject rowValue,\n\t\t\tint rowPosition,\n\t\t\tModificationType modificationType,\n\t\t\tSharedSessionContractImplementor session,\n\t\t\tJdbcValueBindings jdbcValueBindings) {\n\t\tif ( key == null ) {\n\t\t\tthrow new IllegalArgumentException( \"null key for collection: \" + mutationTarget.getRolePath() );\n\t\t}\n\n\t\tdecomposeRowIdentity(\n\t\t\t\tcollection,\n\t\t\t\tkey,\n\t\t\t\trowValue,\n\t\t\t\trowPosition,\n\t\t\t\tsession,\n\t\t\t\tjdbcValueBindings,\n\t\t\t\tParameterUsage.SET\n\t\t);\n\n\t\tif ( !useServerTransactionTimestamps ) {\n\t\t\tjdbcValueBindings.bindValue(\n\t\t\t\t\tsession.getCurrentChangesetIdentifier(),\n\t\t\t\t\tauditTableName,\n\t\t\t\t\tchangesetIdMapping.getSelectionExpression(),\n\t\t\t\t\tParameterUsage.SET","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/persister/collection/mutation/AuditCollectionRowMutationHelper.java#L44-L80","documentation":"Error \"null key for collection: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when mutating an audit collection row with a null collection key, indicating the owner entity has no identifier value.","commonSituations":"See trigger scenarios.","solutions":["Ensure the collection's owner entity is loaded and its key is set before triggering collection row mutation (e.g. do not flush orphan audit collections)."],"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"}