hibernate/hibernate-orm · error · PropertyAccessBuildingException

Could not locate field for property named [" + containerJava

Error message

Could not locate field for property named [" + containerJavaType.getName() + "#" + propertyName + "]

What it means

Error "Could not locate field for property named [" + containerJavaType.getName() + "#" + propertyName + "]" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessMixedImpl.java:47

 *
 * @author Steve Ebersole
 */
public class PropertyAccessMixedImpl implements PropertyAccess {
	private final PropertyAccessStrategy strategy;

	private final Getter getter;
	@Nullable
	private final Setter setter;

	public PropertyAccessMixedImpl(PropertyAccessStrategy strategy, Class<?> containerJavaType, String propertyName) {
		this.strategy = strategy;

		final var propertyAccessType = getAccessType( containerJavaType, propertyName );
		switch ( propertyAccessType ) {
			case FIELD: {
				final var field = fieldOrNull( containerJavaType, propertyName );
				if ( field == null ) {
					throw new PropertyAccessBuildingException(
							"Could not locate field for property named [" + containerJavaType.getName() + "#" + propertyName + "]"
					);
				}
				getter = fieldGetter( containerJavaType, propertyName, field );
				setter = fieldSetter( containerJavaType, propertyName, field );
				break;
			}
			case PROPERTY: {
				final var getterMethod = getterMethodOrNull( containerJavaType, propertyName );
				if ( getterMethod == null ) {
					throw new PropertyAccessBuildingException(
							"Could not locate getter for property named [" + containerJavaType.getName() + "#" + propertyName + "]"
					);
				}
				final var setterMethod = findSetterMethod( containerJavaType, propertyName, getterMethod.getReturnType() );

				getter = propertyGetter( containerJavaType, propertyName, getterMethod );
				setter = propertySetter( containerJavaType, propertyName, setterMethod );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Declare a field with the mapped property name on the class (or its hierarchy).
  2. Fix the property name in the mapping to match an existing field.

When it happens

Trigger: A name referenced in a mapping, query, or configuration cannot be resolved at runtime.

Common situations: Typos in entity/attribute/mapping names, missing mappings, or refactoring without updating references.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/ff1465adefb52ffd. Report an issue: GitHub.