hibernate/hibernate-orm · error · MappingException

Unknown property

Error message

Unknown property: ${propertyName}

What it means

Property-resolution guard in getPropertyColumnNames: resolvePropertyPath returned null for the given property name, meaning no property with that path exists on this entity mapping (including inherited properties). The faulty input is propertyName as passed to getPropertyColumnNames/toColumns; commonly caused by typos or by querying through a superclass persister for a subclass-only property.

Solutions

  1. Correct the property name in the query/mapping to one declared on the entity.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when a query or entity graph references a property name that does not exist on the entity.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java:2433

	public String[] toColumns(String propertyName) throws QueryException {
		return getPropertyColumnNames( propertyName );
	}

	/**
	 * {@inheritDoc}
	 *
	 * Warning:
	 * When there are duplicated property names in the subclasses
	 * then this method may return the wrong results.
	 * To ensure correct results, this method should only be used when
	 * {@literal this} is the concrete EntityPersister (since the
	 * concrete EntityPersister cannot have duplicated property names).
	 */
	@Override
	public String[] getPropertyColumnNames(String propertyName) {
		final var propertyPath = resolvePropertyPath( propertyName );
		if ( propertyPath == null ) {
			throw new MappingException( "Unknown property: " + propertyName );
		}
		return propertyPath.columnNames();
	}

	private DiscriminatorType<?> discriminatorDomainType;

	@Override
	public DiscriminatorType<?> getDiscriminatorDomainType() {
		if ( discriminatorDomainType == null ) {
			discriminatorDomainType = buildDiscriminatorType();
		}
		return discriminatorDomainType;
	}

	private DiscriminatorType<?> buildDiscriminatorType() {
		final var discriminatorBasicType = getDiscriminatorType();
		return discriminatorBasicType == null
				? null

View on GitHub (pinned to fad1729dce)