"LazyInitializationException: Unable to perform requested lazy initialization" when merging a detached entity in Hibernate

Solution Verified - Updated -


  • Enabling bytecode enhancement with <enableLazyInitialization>true</enableLazyInitialization>
  • Using @LazyToOne(LazyToOneOption.NO_PROXY) on a ManyToOne 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


  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • Hibernate 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In