{"record":{"id":"32356a946f71e640","repo":"hibernate/hibernate-orm","slug":"method-not-supported-when-2lc-is-not-enabled","errorCode":null,"errorMessage":"Method not supported when 2LC is not enabled","messagePattern":"Method not supported when 2LC is not enabled","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingTransactionSynchronizationImpl.java","lineNumber":21,"sourceCode":" * Copyright Red Hat Inc. and Hibernate Authors\n */\npackage org.hibernate.cache.internal;\n\nimport org.hibernate.cache.spi.CacheTransactionSynchronization;\n\n/**\n * @author Steve Ebersole\n */\npublic class NoCachingTransactionSynchronizationImpl implements CacheTransactionSynchronization {\n\tpublic static final NoCachingTransactionSynchronizationImpl INSTANCE = new NoCachingTransactionSynchronizationImpl();\n\n\tprivate NoCachingTransactionSynchronizationImpl() {\n\t\t//noop\n\t}\n\n\t@Override\n\tpublic long getCachingTimestamp() {\n\t\tthrow new UnsupportedOperationException(\"Method not supported when 2LC is not enabled\");\n\t}\n\n\t@Override\n\tpublic void transactionJoined() {\n\t\t//noop\n\t}\n\n\t@Override\n\tpublic void transactionCompleting() {\n\t\t//noop\n\t}\n\n\t@Override\n\tpublic void transactionCompleted(boolean successful) {\n\t\t//noop\n\t}\n}\n","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingTransactionSynchronizationImpl.java#L3-L39","documentation":"Error \"Method not supported when 2LC is not enabled\" 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":["Enable the second-level cache (hibernate.cache.use_second_level_cache=true with a RegionFactory) before calling this cache-transaction-synchronization API."],"exampleFix":"Enable the second-level cache (hibernate.cache.use_second_level_cache=true with a RegionFactory) before calling this cache-transaction-synchronization API.","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"}