perf(document): EAGER→LAZY migration with @EntityGraph + @BatchSize (#467) #622

Merged
marcel merged 19 commits from worktree-feat+issue-467-lazy-fetch-entity-graph into main 2026-05-19 09:23:32 +02:00
Showing only changes of commit 3358f0509f - Show all commits

View File

@@ -18,6 +18,7 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean;
import software.amazon.awssdk.services.s3.S3Client;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
@@ -84,7 +85,7 @@ class DocumentLazyLoadingTest {
}
@Test
void getRecentActivity_doesNotThrowLazyInitializationException() {
void getRecentActivity_collectionsAccessibleAfterReturn() {
Person sender = personRepository.save(Person.builder().firstName("Hans").lastName("RaSender").build());
Tag tag = tagRepository.save(Tag.builder().name("RaTag").build());
for (int i = 0; i < 3; i++) {
@@ -96,8 +97,13 @@ class DocumentLazyLoadingTest {
.build());
}
assertThatCode(() -> documentService.getRecentActivity(3))
.doesNotThrowAnyException();
List<Document> results = documentService.getRecentActivity(3);
assertThatCode(() -> {
results.forEach(d -> assertThat(d.getSender()).isNotNull());
results.forEach(d -> assertThat(d.getSender().getLastName()).isNotNull());
results.forEach(d -> d.getTags().size());
}).doesNotThrowAnyException();
}
@Test