hibernate/hibernate-orm · error · IllegalArgumentException
Expecting class: [%1$s], but containerJavaType is of type…
Error message
Expecting class: [%1$s], but containerJavaType is of type: [%2$s] for propertyName: [%3$s]
What it means
Type guard in the Map-based property access strategy: buildPropertyAccess was invoked with a non-null containerJavaType that is not assignable to java.util.Map, so the map-style access (property values read as map keys) cannot apply. The faulty input is containerJavaType; this strategy only suits dynamic-map entity representations or Map-typed targets.
Solutions
- Use the map-based PropertyAccessStrategy only with Map-typed (dynamic-map) entities.
- Change the entity representation mode to POJO if a concrete class is used.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/a083643ee0e4c8bb.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyMapImpl.java:29
import jakarta.annotation.Nullable;
/**
* @author Steve Ebersole
* @author Gavin King
*/
public class PropertyAccessStrategyMapImpl implements PropertyAccessStrategy {
/**
* Singleton access
*/
public static final PropertyAccessStrategy INSTANCE = new PropertyAccessStrategyMapImpl();
@Override
public PropertyAccess buildPropertyAccess(@Nullable Class<?> containerJavaType, String propertyName, boolean setterRequired) {
// Sometimes containerJavaType is null, but if it isn't, make sure it's a Map.
if (containerJavaType != null && !Map.class.isAssignableFrom( containerJavaType)) {
throw new IllegalArgumentException(
String.format(
"Expecting class: [%1$s], but containerJavaType is of type: [%2$s] for propertyName: [%3$s]",
Map.class.getName(),
containerJavaType.getName(),
propertyName
)
);
}
return new PropertyAccessMapImpl( this, propertyName );
}
}
View on GitHub (pinned to fad1729dce)