{"record":{"id":"11b73c929686205b","repo":"hibernate/hibernate-orm","slug":"could-not-resolve-propertyaccess-for-attribute-s-11b73c","errorCode":null,"errorMessage":"Could not resolve PropertyAccess for attribute `%s#%s`","messagePattern":"Could not resolve PropertyAccess for attribute `(.+?)#(.+?)`","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java","lineNumber":314,"sourceCode":"\t\t\t);\n\t\t}\n\t\tcatch (HibernateException he) {\n\t\t\tCORE_LOGGER.unableToCreateProxyFactory( entityName, he );\n\t\t\treturn null;\n\t\t}\n\t\treturn proxyFactory;\n\t}\n\n\tprivate ReflectionOptimizer resolveReflectionOptimizer(BytecodeProvider bytecodeProvider) {\n\t\treturn bytecodeProvider.getReflectionOptimizer( mappedJtd.getJavaTypeClass(), propertyAccessMap );\n\t}\n\n\tprivate PropertyAccess makePropertyAccess(Property bootAttributeDescriptor, StrategySelector strategySelector) {\n\t\tfinal var mappedClass = mappedJtd.getJavaTypeClass();\n\t\tfinal String descriptorName = bootAttributeDescriptor.getName();\n\t\tfinal var strategy = propertyAccessStrategy( bootAttributeDescriptor, mappedClass, strategySelector );\n\t\tif ( strategy == null ) {\n\t\t\tthrow new HibernateException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\"Could not resolve PropertyAccess for attribute `%s#%s`\",\n\t\t\t\t\t\t\tmappedJtd.getTypeName(),\n\t\t\t\t\t\t\tdescriptorName\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\treturn strategy.buildPropertyAccess( mappedClass, descriptorName, true );\n\t}\n\n\t@Override\n\tpublic RepresentationMode getMode() {\n\t\treturn RepresentationMode.POJO;\n\t}\n\n\t@Override\n\tpublic ReflectionOptimizer getReflectionOptimizer() {","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java#L296-L332","documentation":"Thrown while building the runtime model for a POJO entity (EntityRepresentationStrategyPojoStandard.makePropertyAccess) when no PropertyAccessStrategy can be found for one of the entity's mapped attributes. propertyAccessStrategy(...) consults the StrategySelector with the property and the mapped class; a null result - classically because the mapped class exposes neither a field nor a getter under the mapped attribute name - aborts bootstrap with the entity type and attribute named in the message.","triggerScenarios":"hbm.xml <property name=\"...\"> naming a member that does not exist on the entity class (typo, rename, stale jar); @Access(PROPERTY) expected but the getter for an attribute is missing or non-public in a way the strategies reject; mixed access-type mappings where an attribute has no accessible member on the chosen side.","commonSituations":"Renaming entity getters without updating XML mappings; version skew between the domain jar and mapping resources on the classpath; code-generated mappings (freemarker/velocity templates) emitting wrong attribute names; Kotlin entities where the backing property is private without a getter.","solutions":["Compare the attribute name in the message with the entity class members; fix the mapping or add the missing field/getter","Rebuild the project so mapping files and compiled classes stay in sync","Check the access type in effect for the attribute (@Access on class/property, default from @Id placement) and provide the corresponding member","Search the mapping sources for the exact attribute string to find the offending declaration"],"exampleFix":"// before\n<class name=\"User\" table=\"USERS\">\n    <property name=\"e-mail\" column=\"EMAIL\"/>   <!-- no such member -->\n</class>\npublic class User { private String email; }\n\n// after\n<class name=\"User\" table=\"USERS\">\n    <property name=\"email\" column=\"EMAIL\"/>\n</class>","handlingStrategy":"validation","validationCode":"// Validate mapped entity attribute names against class members before boot\nfor ( Map.Entry<Class<?>, Set<String>> e : mappedAttributesByClass().entrySet() ) {\n    for ( String attr : e.getValue() ) {\n        if ( !attributeAccessible(e.getKey(), attr) ) {\n            throw new IllegalStateException(\"Entity \" + e.getKey() + \" has no member for mapped attribute '\" + attr + \"'\");\n        }\n    }\n}","typeGuard":"static boolean attributeAccessible(Class<?> c, String attr) {\n    try { c.getDeclaredField(attr); return true; } catch (NoSuchFieldException ignored) {}\n    try { c.getMethod(\"get\" + Character.toUpperCase(attr.charAt(0)) + attr.substring(1)); return true; } catch (NoSuchMethodException ignored) {}\n    return false;\n}","tryCatchPattern":"try {\n    EntityManagerFactory emf = Persistence.createEntityManagerFactory(\"pu\");\n}\ncatch ( org.hibernate.HibernateException e ) {\n    if ( e.getMessage() != null && e.getMessage().contains(\"Could not resolve PropertyAccess for attribute\") ) {\n        // the message is `Entity#attribute` - reconcile mapping names with class members\n        throw new ConfigurationError(\"Attribute/mapping mismatch: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Rename entity members and their mapping declarations in the same commit","Prefer annotations over XML so names live next to the fields","Add a CI metadata test that boots the factory for every persistence unit"],"tags":["hibernate","jpa","entity","property-access","mapping","bootstrap"],"backgroundTag":"property-access-resolution-failed","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}