hibernate/hibernate-orm · error · PropertyAccessException
Error accessing field [%s] by reflection for persistent prop
Error message
Error accessing field [%s] by reflection for persistent property [%s#%s] : %s
What it means
Error "Error accessing field [%s] by reflection for persistent property [%s#%s] : %s" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/property/access/spi/GetterFieldImpl.java:50
public GetterFieldImpl(Class<?> containerClass, String propertyName, Field field) {
this ( containerClass, propertyName, field, findGetterMethodForFieldAccess( field, propertyName ) );
}
GetterFieldImpl(Class<?> containerClass, String propertyName, Field field, Method getterMethod) {
this.containerClass = containerClass;
this.propertyName = propertyName;
this.field = field;
this.getterMethod = getterMethod;
}
@Override
public @Nullable Object get(Object owner) {
try {
return field.get( owner );
}
catch (Exception e) {
throw new PropertyAccessException(
String.format(
Locale.ROOT,
"Error accessing field [%s] by reflection for persistent property [%s#%s] : %s",
field.toGenericString(),
containerClass.getName(),
propertyName,
owner
),
e
);
}
}
@Override
public @Nullable Object getForInsert(Object owner, Map<Object, Object> mergeMap, SharedSessionContractImplementor session) {
return get( owner );
}
View on GitHub (pinned to fad1729dce)
Solutions
- Make the field accessible (non-private or open the module) for reflection.
- Check the field name and declaring class in the mapping match the actual class.
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/b31ea3a4bed78e42.
Report an issue: GitHub.