"LazyInitializationException: Unable to perform requested lazy initialization" when merging a detached entity in Hibernate
Issue
- Enabling bytecode enhancement with
<enableLazyInitialization>true</enableLazyInitialization>
- Using
@LazyToOne(LazyToOneOption.NO_PROXY)
on aManyToOne
association -
When merging a detached entity for which the association has not yet been initialized, encountering
... org.hibernate.LazyInitializationException: Unable to perform requested lazy initialization [my_entity_here] - no session and settings disallow loading outside the Session
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 7
- Hibernate 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.