{"record":{"id":"a083643ee0e4c8bb","repo":"hibernate/hibernate-orm","slug":"expecting-class-1-s-but-containerjavatype-is","errorCode":null,"errorMessage":"Expecting class: [%1$s], but containerJavaType is of type: [%2$s] for propertyName: [%3$s]","messagePattern":"Expecting class: \\[%1\\$s\\], but containerJavaType is of type: \\[%2\\$s\\] for propertyName: \\[%3\\$s\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyMapImpl.java","lineNumber":29,"sourceCode":"\nimport jakarta.annotation.Nullable;\n\n/**\n * @author Steve Ebersole\n * @author Gavin King\n */\npublic class PropertyAccessStrategyMapImpl implements PropertyAccessStrategy {\n\t/**\n\t * Singleton access\n\t */\n\tpublic static final PropertyAccessStrategy INSTANCE = new PropertyAccessStrategyMapImpl();\n\n\t@Override\n\tpublic PropertyAccess buildPropertyAccess(@Nullable Class<?> containerJavaType, String propertyName, boolean setterRequired) {\n\n\t\t// Sometimes containerJavaType is null, but if it isn't, make sure it's a Map.\n\t\tif (containerJavaType != null && !Map.class.isAssignableFrom( containerJavaType)) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\tString.format(\n\t\t\t\t\t\"Expecting class: [%1$s], but containerJavaType is of type: [%2$s] for propertyName: [%3$s]\",\n\t\t\t\t\tMap.class.getName(),\n\t\t\t\t\tcontainerJavaType.getName(),\n\t\t\t\t\tpropertyName\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn new PropertyAccessMapImpl( this, propertyName );\n\t}\n}\n","sourceCodeStart":11,"sourceCodeEnd":42,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyMapImpl.java#L11-L42","documentation":"Error \"Expecting class: [%1$s], but containerJavaType is of type: [%2$s] for propertyName: [%3$s]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","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."],"exampleFix":null,"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"}