{"record":{"id":"603fe063108db305","repo":"hibernate/hibernate-orm","slug":"entity-class-classname-is-not-enhanced-for-laz","errorCode":null,"errorMessage":"Entity class [{className}] is not enhanced for lazy loading","messagePattern":"Entity class \\[(.+?)\\] is not enhanced for lazy loading","errorType":"exception","errorClass":"NotInstrumentedException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/bytecode/internal/BytecodeEnhancementMetadataPojoImpl.java","lineNumber":209,"sourceCode":"\n\t\treturn entity;\n\t}\n\n\tprivate static void clearDirtyAttributes(final SelfDirtinessTracker entity) {\n\t\tentity.$$_hibernate_clearDirtyAttributes();\n\t}\n\n\tprivate static void useTracker(final ManagedEntity entity) {\n\t\tentity.$$_hibernate_setUseTracker( true );\n\t}\n\n\t@Override\n\tpublic LazyAttributeLoadingInterceptor injectInterceptor(\n\t\t\tObject entity,\n\t\t\tObject identifier,\n\t\t\tSharedSessionContractImplementor session) {\n\t\tif ( !enhancedForLazyLoading ) {\n\t\t\tthrow new NotInstrumentedException( \"Entity class [\" + entityClass.getName() + \"] is not enhanced for lazy loading\" );\n\t\t}\n\n\t\tif ( !entityClass.isInstance( entity ) ) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\"Passed entity instance [%s] is not of expected type [%s]\",\n\t\t\t\t\t\t\tentity,\n\t\t\t\t\t\t\tgetEntityName()\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\tfinal var interceptor = new LazyAttributeLoadingInterceptor(\n\t\t\t\tlazyAttributeLoadingInterceptorState,\n\t\t\t\tidentifier,\n\t\t\t\tsession\n\t\t);\n\t\tinjectInterceptor( entity, interceptor, session );\n\t\treturn interceptor;","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/bytecode/internal/BytecodeEnhancementMetadataPojoImpl.java#L191-L227","documentation":"Error \"Entity class [{className}] is not enhanced for lazy loading\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Bytecode enhancement, proxy creation, or lazy interception is applied to an incompatible class or configuration.","commonSituations":"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.","solutions":["Enable bytecode enhancement (hibernate-enhance-maven-plugin/Gradle plugin) for the entity, or avoid lazy no-proxy loading for it."],"exampleFix":"Enable bytecode enhancement (hibernate-enhance-maven-plugin/Gradle plugin) for the entity, or avoid lazy no-proxy loading for it.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}