hibernate/hibernate-orm · error · NotInstrumentedException

Entity [ ] is non-pojo, and therefore not instrumented

Error message

Entity [{entityName}] is non-pojo, and therefore not instrumented

What it means

Sentinel used by the non-POJO bytecode metadata implementation: any request to inject a lazy-attribute interceptor into an entity whose mapping is not backed by a real Java class (dynamic-map mode) cannot be honored, since there is no instrumented POJO to intercept. The message is a fixed error string built at construction, not per-call input.

Solutions

  1. Use Hibernate enhancement features only with POJO entity classes; dynamic-map models do not support bytecode interception.

Example fix

Use Hibernate enhancement features only with POJO entity classes; dynamic-map models do not support bytecode interception.
Defensive patterns

Strategy: validation

When it happens

Trigger: Bytecode enhancement, proxy creation, or lazy interception is applied to an incompatible class or configuration.

Common situations: Build-time enhancement with module-system restrictions, mismatched Hibernate versions between build and runtime, or hibernate.bytecode.provider=none with a model that needs proxies.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/bytecode/internal/BytecodeEnhancementMetadataNonPojoImpl.java:56

		return entityName;
	}

	@Override
	public boolean isEnhancedForLazyLoading() {
		return false;
	}

	@Override
	public LazyAttributesMetadata getLazyAttributesMetadata() {
		return lazyAttributesMetadata;
	}

	@Override
	public LazyAttributeLoadingInterceptor injectInterceptor(
			Object entity,
			Object identifier,
			SharedSessionContractImplementor session) throws NotInstrumentedException {
		throw new NotInstrumentedException( errorMsg );
	}

	@Override
	public void injectInterceptor(
			Object entity,
			PersistentAttributeInterceptor interceptor,
			SharedSessionContractImplementor session) {
		throw new NotInstrumentedException( errorMsg );
	}

	@Override
	public void injectEnhancedEntityAsProxyInterceptor(
			Object entity,
			EntityKey entityKey,
			SharedSessionContractImplementor session) {
		throw new NotInstrumentedException( errorMsg );
	}

View on GitHub (pinned to fad1729dce)