hibernate/hibernate-orm · error · PersistenceException

Unrecognized unwrap type [{type.getName()}]

Error message

Unrecognized unwrap type [{type.getName()}]

What it means

Error "Unrecognized unwrap type [{type.getName()}]" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/internal/AbstractQuery.java:108

	}

	@Override
	@Nonnull
	public final <X> X unwrap(Class<X> type) {
		if ( type.isInstance( this ) ) {
			return type.cast( this );
		}

		if ( type == MutationOrSelectionQuery.class ) {
			return type.cast( MutationOrSelectionQueryImpl.from( this ) );
		}

		final X unwrappedDelegate = unwrapDelegates( type );
		if ( unwrappedDelegate != null ) {
			return unwrappedDelegate;
		}

		throw new PersistenceException( "Unrecognized unwrap type [" + type.getName() + "]" );
	}

	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Execution

	protected <R> R executeQuery(Supplier<? extends R> supplier) {
		final var fetchProfiles = beforeQueryHandlingFetchProfiles();
		boolean success = false;
		try {
			final var result = supplier.get();
			success = true;
			return result;
		}
		catch (IllegalQueryOperationException e) {
			throw new IllegalStateException( e );
		}
		catch (HibernateException he) {
			throw getExceptionConverter().convert( he, getQueryOptions().getLockOptions() );

View on GitHub (pinned to fad1729dce)

Solutions

  1. The requested unwrap type is not supported by this query. Use a supported unwrap target type (e.g. the Hibernate Query/SelectionQuery interface actually implemented).

When it happens

Trigger: An unsupported unwrap target type is requested: Unrecognized unwrap type [<value>]

Common situations: Calling Query.unwrap() with an interface the query does not implement.


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