advancedEntity Lifecycle — Persist, Merge, Detach, Remove & Proxies

What causes a LazyInitializationException, precisely?

A lazy-loaded association is represented by a Hibernate proxy that fetches its real data on first access — but only while its originating persistence context is still open. If the entity has since become detached (its transaction/request already ended) and code tries to access that uninitialized proxy field, Hibernate has no open session left to fetch the data from, and throws LazyInitializationException.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What's the difference between the transient and detached entity states?← Back to all Spring Data JPA & Hibernate Mastery questions