hibernate/hibernate-orm · error · HibernateException
Region [%s] returned from RegionFactory [%s] was named diffe
Error message
Region [%s] returned from RegionFactory [%s] was named differently than requested name. Expecting `%s`, but found `%s`
What it means
Error "Region [%s] returned from RegionFactory [%s] was named differently than requested name. Expecting `%s`, but found `%s`" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/cache/internal/EnabledCaching.java:114
}
private TimestampsCache buildTimestampsCache(SessionFactoryImplementor sessionFactory) {
final var timestampsRegion =
regionFactory.buildTimestampsRegion(
DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME,
sessionFactory
);
return sessionFactory.getSessionFactoryOptions().getTimestampsCacheFactory()
.buildTimestampsCache( this, timestampsRegion );
}
@Override
public void prime(@Nonnull Set<DomainDataRegionConfig> cacheRegionConfigs) {
for ( var regionConfig : cacheRegionConfigs ) {
final var region = buildRegion( regionConfig );
regionsByName.put( region.getName(), region );
if ( !Objects.equals( region.getName(), regionConfig.getRegionName() ) ) {
throw new HibernateException(
String.format(
Locale.ROOT,
"Region [%s] returned from RegionFactory [%s] was named differently than requested name. Expecting `%s`, but found `%s`",
region,
getRegionFactory().getClass().getName(),
regionConfig.getRegionName(),
region.getName()
)
);
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Entity caching
for ( var entityAccessConfig : regionConfig.getEntityCaching() ) {
final var navigableRole = entityAccessConfig.getNavigableRole();
entityAccessMap.put( navigableRole, region.getEntityDataAccess( navigableRole ) );
}View on GitHub (pinned to fad1729dce)
Solutions
- Fix the custom RegionFactory so getRegion() returns a region whose name matches the requested name.
Example fix
Fix the custom RegionFactory so getRegion() returns a region whose name matches the requested name.
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/2850bd5a359b0b22.
Report an issue: GitHub.