The problem can be reproduced as follows:
- given: entity with two collections, one lazy, the other eager
- fetch an entity
- refresh the entity
- access the lazy collection → LazyInitializationException as the collection doesn’t contain a session (see below)
Reproducer: https://github.com/ahus1/hibernate-test-case-templates/tree/kc-16069-lazy-initialization-after-refresh Chat with the hibernate team: https://hibernate.zulipchat.com/#narrow/stream/132096-hibernate-user/topic/H5-.3EH6.3A.20LazyInitializationException.20after.20em.2Erefresh.28.29 Issue from the Keycloak team: https://github.com/keycloak/keycloak/issues/19069#issuecomment-1494185743
|