hibernate/hibernate-orm · error · HibernateException

Produced proxy does not correctly implement HibernateProxy

Error message

Produced proxy does not correctly implement HibernateProxy

What it means

Error "Produced proxy does not correctly implement HibernateProxy" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/proxy/pojo/bytebuddy/ByteBuddyProxyFactory.java:90

				componentIdType,
				session,
				overridesEquals
		);

		final var instance = getHibernateProxy();
		final var proxyConfiguration = instance.asProxyConfiguration();
		if ( proxyConfiguration == null ) {
			throw new HibernateException( "Produced proxy does not correctly implement ProxyConfiguration" );
		}
		proxyConfiguration.$$_hibernate_set_interceptor( interceptor );
		return instance;
	}

	private HibernateProxy getHibernateProxy() {
		final var internal = getHibernateProxyInternal();
		final var hibernateProxy = internal.asHibernateProxy();
		if ( hibernateProxy == null ) {
			throw new HibernateException( "Produced proxy does not correctly implement HibernateProxy" );
		}
		return hibernateProxy;
	}

	/**
	 * This technically returns a HibernateProxy, but declaring that type as the return
	 * type for the newInstance() action triggers an implicit case of type pollution.
	 * We therefore declare it as PrimeAmongSecondarySupertypes, and require the
	 * invoker to perform the narrowing
	 */
	private PrimeAmongSecondarySupertypes getHibernateProxyInternal() throws HibernateException {
		try {
			return (PrimeAmongSecondarySupertypes) proxyClass.getConstructor().newInstance();
		}
		catch (NoSuchMethodException e) {
			throw new HibernateException(
					"Bytecode enhancement failed because no public, protected or package-private default constructor was found for entity '"
							+ entityName + "' (private constructors don't work with runtime proxies)", e );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Ensure the proxy generation completed without interference from other bytecode tools.
  2. Align Hibernate and ByteBuddy versions.

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