{"record":{"id":"fd4c68521d11c435","repo":"hibernate/hibernate-orm","slug":"unable-to-resolve-audit-table-mapping-for-s","errorCode":null,"errorMessage":"Unable to resolve audit table mapping for %s","messagePattern":"Unable to resolve audit table mapping for (.+?)","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/EntityAuditSupport.java","lineNumber":608,"sourceCode":"\t\t\t\tauditTableMapping.isCascadeDeleteEnabled(),\n\t\t\t\ttableMapping.getInsertDetails(),\n\t\t\t\ttableMapping.getUpdateDetails(),\n\t\t\t\ttableMapping.getDeleteDetails(),\n\t\t\t\tList.of(),\n\t\t\t\tList.of(),\n\t\t\t\tMap.of(),\n\t\t\t\tidentifierTableDescriptor.keyDescriptor()\n\t\t);\n\t}\n\n\tprivate int resolveAuditTableIndex(String tableName) {\n\t\tfor ( int i = 0; i < auditTableMappings.length; i++ ) {\n\t\t\tif ( auditTableMappings[i] != null\n\t\t\t\t\t&& auditTableMappings[i].getTableName().equals( tableName ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\tthrow new MappingException( \"Unable to resolve audit table mapping for \" + tableName );\n\t}\n\n\tprivate boolean[] applyAuditMask(boolean[] propertyInclusions) {\n\t\tfinal boolean[] masked = propertyInclusions.clone();\n\t\tfor ( int i = 0; i < masked.length; i++ ) {\n\t\t\tif ( !auditedPropertyMask[i] ) {\n\t\t\t\tmasked[i] = false;\n\t\t\t}\n\t\t}\n\t\treturn masked;\n\t}\n\n\tprivate static boolean isValueGenerated(Generator generator) {\n\t\treturn generator != null\n\t\t\t\t&& generator.generatesOnInsert()\n\t\t\t\t&& generator.generatedOnExecution();\n\t}\n","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/EntityAuditSupport.java#L590-L626","documentation":"EntityAuditSupport.resolveAuditTableIndex maps a mutating table name to its entry in auditTableMappings; entries can be null for tables excluded from auditing. MappingException 'Unable to resolve audit table mapping for <table>' means a mutation is being applied to a table that has no audit mapping - it is excluded (or unknown) while the mutation coordinator still needs to write audit data for it.","triggerScenarios":"An entity with secondary tables whose audit mapping excludes one of them, while inserts/updates still write that table; a subclass table mutated when the audit mapping only covered the root; audit table names out of sync with entity table names after schema or mapping edits.","commonSituations":"Excluding audit coverage for a @SecondaryTable but leaving its attributes updatable; adding secondary or subclass tables after the audit mapping was defined; partial table renames between the entity mapping and the audit configuration.","solutions":["Include every mutable table of the entity in the audit mapping","Or make the excluded table's attributes insertable=false/updatable=false so no mutation targets it","Re-generate or refresh the audit mapping after schema changes so table sets match","Add a boot-time consistency check comparing persister table names with audit-mapped table names"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the audit mapping's table set in sync with the entity's tables after any schema change","If a secondary table is excluded from auditing, mark its attributes non-insertable/non-updatable","Add a boot check comparing persister tables with audit-mapped tables"],"tags":["hibernate","orm","auditing","secondary-table","mapping"],"backgroundTag":"audit-mapping-missing","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}