hibernate/hibernate-orm · error · PropertyAccessBuildingException

Could not locate getter for property named [" + containerJav

Error message

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

What it means

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

Source

Thrown at hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessGetterImpl.java:51

	public PropertyAccessGetterImpl(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 );
				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 + "]"
					);
				}
				getter = propertyGetter( containerJavaType, propertyName, getterMethod );
				break;
			}
			default: {
				throw new PropertyAccessBuildingException(
						"Invalid access type " + propertyAccessType + " for property named [" + containerJavaType.getName() + "#" + propertyName + "]"
				);
			}
		}
	}

	// --- //

	private static Getter fieldGetter(Class<?> containerJavaType, String propertyName, Field field) {
		return new GetterFieldImpl( containerJavaType, propertyName, field );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add a getter method matching JavaBean naming (getX/isX) for the property on the class.
  2. Check that the property name in the mapping matches the actual field/getter name.

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/7e75b1eac08b3882. Report an issue: GitHub.