hibernate/hibernate-orm · error · UnsupportedOperationException
Method not supported when 2LC is not enabled
Error message
Method not supported when 2LC is not enabled
What it means
Error "Method not supported when 2LC is not enabled" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingTransactionSynchronizationImpl.java:21
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.cache.internal;
import org.hibernate.cache.spi.CacheTransactionSynchronization;
/**
* @author Steve Ebersole
*/
public class NoCachingTransactionSynchronizationImpl implements CacheTransactionSynchronization {
public static final NoCachingTransactionSynchronizationImpl INSTANCE = new NoCachingTransactionSynchronizationImpl();
private NoCachingTransactionSynchronizationImpl() {
//noop
}
@Override
public long getCachingTimestamp() {
throw new UnsupportedOperationException("Method not supported when 2LC is not enabled");
}
@Override
public void transactionJoined() {
//noop
}
@Override
public void transactionCompleting() {
//noop
}
@Override
public void transactionCompleted(boolean successful) {
//noop
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Enable the second-level cache (hibernate.cache.use_second_level_cache=true with a RegionFactory) before calling this cache-transaction-synchronization API.
Example fix
Enable the second-level cache (hibernate.cache.use_second_level_cache=true with a RegionFactory) before calling this cache-transaction-synchronization API.
When it happens
Trigger: Second-level caching is misconfigured or a cache region/key does not match what Hibernate expects.
Common situations: Enabling @Cacheable entities without setting hibernate.cache.region.factory_class, custom RegionFactory implementations, or unwrapping Cache to provider types.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/32356a946f71e640.
Report an issue: GitHub.