hibernate/hibernate-orm · error · PropertyNotFoundException

Could not locate field name [%s] on class [%s]

Error message

Could not locate field name [%s] on class [%s]

What it means

Error "Could not locate field name [%s] on class [%s]" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java:398

		try {
			return clazz.getMethod( methodName, paramTypes );
		}
		catch (Exception e) {
			return null;
		}
	}

	public static Field findField(Class<?> containerClass, String propertyName) {
		if ( containerClass == null ) {
			throw new IllegalArgumentException( "Class<?> on which to find field [" + propertyName + "] cannot be null" );
		}
		else if ( containerClass == Object.class ) {
			throw new IllegalArgumentException( "Illegal attempt to locate field [" + propertyName + "] on Object.class" );
		}
		else {
			final Field field = locateField( containerClass, propertyName );
			if ( field == null ) {
				throw new PropertyNotFoundException(
						String.format(
								Locale.ROOT,
								"Could not locate field name [%s] on class [%s]",
								propertyName,
								containerClass.getName()
						)
				);
			}
			ensureAccessibility( field );
			return field;
		}
	}

	public static void ensureAccessibility(AccessibleObject accessibleObject) {
		if ( !accessibleObject.isAccessible() ) {
			accessibleObject.setAccessible( true );
		}
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Verify the property/field name exists on the class (check spelling and mapping); fields in superclasses are only found when walking the hierarchy.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java:398 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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