perf(document): add @BatchSize(50) to sender and trainingLabels

Consistent with the @BatchSize already on receivers and tags. Any lazy
code path not covered by an entity graph will batch-load these associations
instead of issuing one query per document.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-18 19:03:09 +02:00
committed by marcel
parent 6266c5f721
commit 914e438793

View File

@@ -136,6 +136,7 @@ public class Document {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "sender_id")
@BatchSize(size = 50)
private Person sender;
@ManyToMany(fetch = FetchType.LAZY)
@@ -148,6 +149,7 @@ public class Document {
@CollectionTable(name = "document_training_labels", joinColumns = @JoinColumn(name = "document_id"))
@Column(name = "label")
@Enumerated(EnumType.STRING)
@BatchSize(size = 50)
@Builder.Default
private Set<TrainingLabel> trainingLabels = new HashSet<>();