# org.hibernate.LazyInitializationException: could not initialize proxy - no Session

**Code:** `LazyInitializationException` · **Category:** Java · **Seen on:** Java

A lazy-loaded association was accessed after the Hibernate session/transaction closed.

## Meaning

Lazy collections and proxies load on first access, which needs an open session. Accessing them in the controller/view or during JSON serialization after the transaction ended fails.

## Common causes

- Accessing lazy relations outside @Transactional
- Serializing entities to JSON after the service returns
- Open Session in View disabled

## Quick fix

1. Fetch what you need in the query (JOIN FETCH / @EntityGraph)
2. Map to DTOs inside the transaction
3. Mark the service method @Transactional(readOnly = true)

## Detailed fix by platform

### Java

1. `@Query("select o from Order o join fetch o.items where o.id = :id")`

## How to diagnose

1. **Association** — Which relation?
2. **Boundary** — Where does the transaction end?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/java/lazyinitializationexception)
