{"record":{"id":"194bb1555b711219","repo":"hibernate/hibernate-orm","slug":"cache-override-referenced-an-unknown-collection-ro","errorCode":null,"errorMessage":"Cache override referenced an unknown collection role : {}","messagePattern":"Cache override referenced an unknown collection role : (.+?)","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java","lineNumber":1977,"sourceCode":"\t\t\t\t\tif ( entityBinding == null ) {\n\t\t\t\t\t\tthrow new HibernateException(\n\t\t\t\t\t\t\t\t\"Cache override referenced an unknown entity : \" + cacheRegionDefinition.role()\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif ( !(entityBinding instanceof RootClass rootClass) ) {\n\t\t\t\t\t\tthrow new HibernateException(\n\t\t\t\t\t\t\t\t\"Cache override referenced a non-root entity : \" + cacheRegionDefinition.role()\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tentityBinding.setCached( true );\n\t\t\t\t\trootClass.setCacheRegionName( cacheRegionDefinition.region() );\n\t\t\t\t\trootClass.setCacheConcurrencyStrategy( cacheRegionDefinition.usage() );\n\t\t\t\t\trootClass.setLazyPropertiesCacheable( cacheRegionDefinition.cacheLazy() );\n\t\t\t\t}\n\t\t\t\telse if ( cacheRegionDefinition.regionType() == CacheRegionDefinition.CacheRegionType.COLLECTION ) {\n\t\t\t\t\tfinal var collectionBinding = getCollectionBinding( cacheRegionDefinition.role() );\n\t\t\t\t\tif ( collectionBinding == null ) {\n\t\t\t\t\t\tthrow new HibernateException(\n\t\t\t\t\t\t\t\t\"Cache override referenced an unknown collection role : \" + cacheRegionDefinition.role()\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcollectionBinding.setCacheRegionName( cacheRegionDefinition.region() );\n\t\t\t\t\tcollectionBinding.setCacheConcurrencyStrategy( cacheRegionDefinition.usage() );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean isInSecondPass() {\n\t\treturn inSecondPass;\n\t}\n\n\t/**\n\t * Builds the complete and immutable Metadata instance from the collected info.\n\t *","sourceCodeStart":1959,"sourceCodeEnd":1995,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/internal/InFlightMetadataCollectorImpl.java#L1959-L1995","documentation":"Error \"Cache override referenced an unknown collection role : {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A mapping references an entity or collection role that is not known at that point.","commonSituations":"hbm.xml <key> property-refs or jakarta.persistence cache overrides naming entities/roles that are unmapped or not root entities.","solutions":["Use the exact collection role (entityName.propertyName) in the cache configuration; check spelling of both parts.","Confirm the collection is actually mapped with the given property name on the stated entity.","Remove cache settings for collections that were renamed or deleted."],"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"}