{"record":{"id":"42244fc147d936db","repo":"hibernate/hibernate-orm","slug":"cache-retrieval-not-supported","errorCode":null,"errorMessage":"Cache retrieval not supported","messagePattern":"Cache retrieval not supported","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/internal/AbstractQuery.java","lineNumber":440,"sourceCode":"\t@Override\n\t@SuppressWarnings(\"removal\")\n\t@Nullable\n\tpublic String getCacheRegion() {\n\t\treturn queryOptions.getResultCacheRegionName();\n\t}\n\n\t@Override\n\t@SuppressWarnings(\"removal\")\n\tpublic Query<T> setCacheRegion(@Nullable String cacheRegion) {\n\t\tverifySelectionOption( \"Result caching\" );\n\t\tqueryOptions.setResultCacheRegionName( cacheRegion );\n\t\treturn this;\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic CacheRetrieveMode getCacheRetrieveMode() {\n\t\tthrow new IllegalStateException( \"Cache retrieval not supported\" );\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic QueryImplementor<T> setCacheRetrieveMode(@Nonnull CacheRetrieveMode cacheRetrieveMode) {\n\t\tverifySelectionOption( \"Result caching\" );\n\t\tsuper.setCacheRetrieveMode( cacheRetrieveMode );\n\t\treturn this;\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic CacheStoreMode getCacheStoreMode() {\n\t\tthrow new IllegalStateException( \"Cache storage not supported\" );\n\t}\n\n\t@Override\n\t@Nonnull","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/internal/AbstractQuery.java#L422-L458","documentation":"Error \"Cache retrieval not supported\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Query caching is used in an unsupported way: Cache retrieval not supported","commonSituations":"Enabling result-set caching on historical (audit) queries, or using cache modes the query does not support.","solutions":["Cache retrieval (CacheRetrieveMode) is not supported for this query kind. Do not set a cache retrieve mode here."],"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"}