hibernate/hibernate-orm · error · PropertySetterAccessException

IllegalArgumentException occurred while calling setter for…

Error message

IllegalArgumentException occurred while calling setter for property [%s.%s (expected type = %s)]; target = [%s], property value = [%s]

What it means

Wraps IllegalArgumentException from Method.invoke while calling a property setter (after null-to-primitive was ruled out): the value's runtime type does not match the setter's expected parameter type, as also reported via illegalPropertySetterArgument/expectedType logging. The faulty input is the value argument; align the value type with the setter parameter or fix the converter producing it.

Solutions

  1. Pass a value assignable to the property's declared type.
  2. Register an AttributeConverter if the persisted type differs from the property type.
Defensive patterns

Strategy: try-catch

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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterMethodImpl.java:100

					propertyName
			);
			//cannot occur
		}
		catch (IllegalArgumentException iae) {
			if ( value == null && isPrimitive ) {
				throw new PropertyAccessException(
						iae,
						"Null value was assigned to a property of primitive type",
						true,
						containerClass,
						propertyName
				);
			}
			else {
				final var expectedType = setterMethod.getParameterTypes()[0];
				CORE_LOGGER.illegalPropertySetterArgument( containerClass.getName(), propertyName );
				CORE_LOGGER.expectedType( expectedType.getName(), value == null ? null : value.getClass().getName() );
				throw new PropertySetterAccessException(
						iae,
						containerClass,
						propertyName,
						expectedType,
						target,
						value
				);
			}
		}
	}

	public Class<?> getContainerClass() {
		return containerClass;
	}

	@Override
	public String getMethodName() {
		return setterMethod.getName();

View on GitHub (pinned to fad1729dce)