fix(document): add trainingLabels to Document.full entity graph #642
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
GET /api/documents/{id}returns HTTP 500 sincetrainingLabelswas made LAZY in #467.Root cause:
Document.trainingLabelsis@ElementCollection(fetch = FetchType.LAZY)but is not included in theDocument.fullentity graph:DocumentRepository.findById()uses@EntityGraph("Document.full"), which loads sender/receivers/tags eagerly. The transaction closes whengetDocumentById()returns. When Jackson later serializes theDocument, it accessestrainingLabelswith no Hibernate session open →LazyInitializationException.Error in staging logs:
Fix
Add
trainingLabelstoDocument.full:Acceptance criteria
GET /api/documents/{id}returns 200 with a document that hastrainingLabelsDocumentLazyLoadingTestpass