{"record":{"id":"57918d057429459a","repo":"hibernate/hibernate-orm","slug":"second-level-cache-is-used-in-the-application-but","errorCode":null,"errorMessage":"Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given; please either disable second-level cache or set correct region factory using the hibernate.cache.region.factory_class setting and make sure the second-level cache provider (hibernate-infinispan, e.g.) is available on the classpath.","messagePattern":"Second-level cache is used in the application, but property hibernate\\.cache\\.region\\.factory_class is not given; please either disable second-level cache or set correct region factory using the hibernate\\.cache\\.region\\.factory_class setting and make sure the second-level cache provider \\(hibernate-infinispan, e\\.g\\.\\) is available on the classpath\\.","errorType":"exception","errorClass":"NoCacheRegionFactoryAvailableException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java","lineNumber":84,"sourceCode":"\t}\n\n\t@Override\n\tpublic long nextTimestamp() {\n\t\treturn System.currentTimeMillis();\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic CacheTransactionSynchronization createTransactionContext(@Nonnull SharedSessionContractImplementor session) {\n\t\treturn NoCachingTransactionSynchronizationImpl.INSTANCE;\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic DomainDataRegion buildDomainDataRegion(\n\t\t\t@Nonnull DomainDataRegionConfig regionConfig,\n\t\t\t@Nonnull DomainDataRegionBuildingContext buildingContext) {\n\t\tthrow new NoCacheRegionFactoryAvailableException();\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic QueryResultsRegion buildQueryResultsRegion(\n\t\t\t@Nonnull String regionName,\n\t\t\t@Nonnull SessionFactoryImplementor sessionFactory) {\n\t\tthrow new NoCacheRegionFactoryAvailableException();\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic TimestampsRegion buildTimestampsRegion(\n\t\t\t@Nonnull String regionName,\n\t\t\t@Nonnull SessionFactoryImplementor sessionFactory) {\n\t\tthrow new NoCacheRegionFactoryAvailableException();\n\t}\n}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java#L66-L102","documentation":"Error \"Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given; please either disable second-level cache or set correct region factory using the hibernate.cache.region.factory_class setting and make sure the second-level cache provider (hibernate-infinispan, e.g.) is available on the classpath.\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Second-level caching is misconfigured or a cache region/key does not match what Hibernate expects.","commonSituations":"Enabling @Cacheable entities without setting hibernate.cache.region.factory_class, custom RegionFactory implementations, or unwrapping Cache to provider types.","solutions":["Set hibernate.cache.region.factory_class (e.g. org.hibernate.cache.jcache.JCacheRegionFactory or infinispan) and add the cache provider to the classpath, or disable the second-level cache."],"exampleFix":"Set hibernate.cache.region.factory_class (e.g. org.hibernate.cache.jcache.JCacheRegionFactory or infinispan) and add the cache provider to the classpath, or disable the second-level cache.","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"}