hibernate/hibernate-orm · error · IllegalSelectQueryException

Not a HQL query

Error message

Not a HQL query

What it means

Type-narrowing guard on query interfaces: an operation that only makes sense for HQL/JPQL queries (exposed via the common query supertype) was invoked on a ProcedureCall, which has no HQL query string. The faulty input is the ProcedureCall instance being viewed/used as an HQL query; branch on the query kind before calling HQL-only methods.

Solutions

  1. Do not treat a ProcedureCall as an HQL query; use the ProcedureCall API.
  2. Use session.createQuery(hql) if an HQL query is intended.
Defensive patterns

Strategy: type-guard

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/1d3884c5c05d2886. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java:1600

	@Override @Deprecated @SuppressWarnings("deprecation")
	@Nonnull
	public ProcedureCallImplementor<R> setParameter(int position, @Nullable Calendar value, @Nonnull TemporalType temporalPrecision) {
		super.setParameter( position, value, temporalPrecision );
		return this;
	}

	@Override @Deprecated @SuppressWarnings("deprecation")
	@Nonnull
	public ProcedureCallImplementor<R> setParameter(int position, @Nullable Date value, @Nonnull TemporalType temporalPrecision) {
		checkNotClosed();
		super.setParameter( position, value, temporalPrecision );
		return this;
	}

	@Override
	@Nonnull
	public <X> SelectionQueryImplementor<X> asSelectionQuery(EntityGraph<X> entityGraph, GraphSemantic graphSemantic) {
		throw new IllegalSelectQueryException( "Not a HQL query", getQueryString() );
	}

	@Nonnull
	@Override
	public QueryParameterImplementor<?> getParameter(@Nonnull String name) {
		checkNotClosed();
		return super.getParameter( name );
	}

	@Nonnull
	@Override
	public <T> QueryParameterImplementor<T> getParameter(@Nonnull String name, @Nonnull Class<T> type) {
		checkNotClosed();
		return super.getParameter( name, type );
	}

	@Nonnull
	@Override

View on GitHub (pinned to fad1729dce)