hibernate/hibernate-orm · error · PropertyAccessException

Could not set value of type [%s]

Error message

Could not set value of type [%s]

What it means

Error "Could not set value of type [%s]" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/property/access/spi/SetterFieldImpl.java:71

			field.set( target, value );
		}
		catch (Exception e) {
			if ( value == null && field.getType().isPrimitive() ) {
				throw new PropertyAccessException(
						e,
						String.format(
								Locale.ROOT,
								"Null value was assigned to a property [%s.%s] of primitive type",
								containerClass,
								propertyName
						),
						true,
						containerClass,
						propertyName
				);
			}
			else {
				throw new PropertyAccessException(
						e,
						String.format(
								Locale.ROOT,
								"Could not set value of type [%s]",
								typeName( value )
						),
						true,
						containerClass,
						propertyName
				);
			}
		}
	}

	private static String typeName(@Nullable Object value) {
		final var lazyInitializer = extractLazyInitializer( value );
		if ( lazyInitializer != null ) {
			return lazyInitializer.getEntityName();

View on GitHub (pinned to fad1729dce)

Solutions

  1. Ensure the value type matches the field type or register an appropriate converter.
  2. Check the JDBC type mapping for the column.

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