FasterXML / FasterXML/jackson-datatype-hibernate

PersistentCollection fails on detached entities with FORCE_LAZY_LOADING

Open
#98 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
331
Forks
108
Avg merge
5h 3m
Merged PRs (30d)
1

Description

When `Feature.FORCE_LAZY_LOADING` is enabled, serialising a detached entity that has an non-initialised `PersistentCollection` fails with a `com.fasterxml.jackson.databind.JsonMappingException: failed to lazily initialize a collection of role: ..., could not initialize proxy - no Session`.

The workaround is to call `Hibernate.initialize(Object)` on collection before detaching the containing entity.

I can somehow imaging why this is expected behaviour, but shouldn't lazy loading be treated differently for detached entities?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.