hibernate/hibernate-orm · error · IllegalArgumentException

implementingType.getTypeName() + " is not a subtype of " + g

Error message

implementingType.getTypeName() + " is not a subtype of " + genericType.getName()

What it means

Error "implementingType.getTypeName() + " is not a subtype of " + genericType.getName()" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/GenericsHelper.java:165

		}
	}

	/**
	 * Get the type argument of the instantiation of the given generic
	 * type constructor which is a supertype of the given type expression.
	 * @param genericType A generic type constructor
	 * @param implementingType A type expression
	 * @return The type arguments assigned to parameters of the generic type constructor
	 */
	public static Type[] typeArguments(Class<?> genericType, Type implementingType) {
		if ( genericType.getTypeParameters().length == 0 ) {
			return EMPTY_TYPE_ARRAY;
		}
		else {
			final var instantiation =
					supertypeInstantiation( genericType, implementingType );
			if ( instantiation == null ) {
				throw new IllegalArgumentException(
						implementingType.getTypeName()
						+ " is not a subtype of "
						+ genericType.getName() );
			}
			return instantiation.getActualTypeArguments();
		}
	}

	private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];

	/**
	 * A supertype of the given type which is an instantiation of the
	 * given generic type constructor.
	 * @param genericType A generic type constructor
	 * @param base A type which is assignable to some instantiation of
	 *             the given generic type constructor
	 * @return An instantiation of the generic type constructor which
	 *         is a supertype of the given type, or null if none exists

View on GitHub (pinned to fad1729dce)

Solutions

  1. Ensure the implementing class actually extends/implements the generic type being inspected; correct the class hierarchy or the lookup call.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/util/GenericsHelper.java:165 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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