From 9a460b3c900594e1e90c529baf20ced1c6a0ab7e Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 20 May 2026 08:16:19 +0200 Subject: [PATCH] fix(document): add trainingLabels to Document.full entity graph (#642) trainingLabels was switched to LAZY fetch in #467 but not added to the Document.full @NamedEntityGraph. DocumentRepository.findById() uses Document.full to eagerly load sender/receivers/tags, but the Hibernate session closes before Jackson serializes the response. Accessing trainingLabels outside the session throws LazyInitializationException, causing GET /api/documents/{id} to return HTTP 500. Co-Authored-By: Claude Sonnet 4.6 --- .../java/org/raddatz/familienarchiv/document/Document.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/org/raddatz/familienarchiv/document/Document.java b/backend/src/main/java/org/raddatz/familienarchiv/document/Document.java index 3e8cac51..21052240 100644 --- a/backend/src/main/java/org/raddatz/familienarchiv/document/Document.java +++ b/backend/src/main/java/org/raddatz/familienarchiv/document/Document.java @@ -25,7 +25,8 @@ import java.util.UUID; @NamedEntityGraph(name = "Document.full", attributeNodes = { @NamedAttributeNode("sender"), @NamedAttributeNode("receivers"), - @NamedAttributeNode("tags") + @NamedAttributeNode("tags"), + @NamedAttributeNode("trainingLabels") }) @NamedEntityGraph(name = "Document.list", attributeNodes = { @NamedAttributeNode("sender"),