chore(document): address non-blocking review feedback on lazy-fetch PR
All checks were successful
CI / Unit & Component Tests (push) Successful in 3m11s
CI / OCR Service Tests (push) Successful in 20s
CI / Backend Unit Tests (push) Successful in 3m41s
CI / fail2ban Regex (push) Successful in 44s
CI / Semgrep Security Scan (push) Successful in 19s
CI / Compose Bucket Idempotency (push) Successful in 1m0s
All checks were successful
CI / Unit & Component Tests (push) Successful in 3m11s
CI / OCR Service Tests (push) Successful in 20s
CI / Backend Unit Tests (push) Successful in 3m41s
CI / fail2ban Regex (push) Successful in 44s
CI / Semgrep Security Scan (push) Successful in 19s
CI / Compose Bucket Idempotency (push) Successful in 1m0s
- Add @BatchSize(50) fallback comments on findBySenderId / findByReceiversId - Replace silent size() discard in getRecentActivity test with assertThat isNotEmpty() - Add ADR-022 reference comment above @JsonIgnoreProperties on Person and Tag - Document within-open-transaction limitation in DocumentLazyLoadingTest Javadoc Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #622.
This commit is contained in:
@@ -28,6 +28,17 @@ import static org.assertj.core.api.Assertions.assertThatCode;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Verifies that lazy-loaded associations on {@link Document} are accessible after a service
|
||||
* method returns — i.e. no {@link org.hibernate.LazyInitializationException} is thrown outside
|
||||
* the Hibernate session that loaded the entity.
|
||||
*
|
||||
* <p><b>Known limitation:</b> calling {@code getDocumentById} (or any other service method) from
|
||||
* within an already-open transaction is not covered here. When an outer transaction is active,
|
||||
* the service's own {@code @Transactional} merges into it and Hibernate keeps the same session
|
||||
* open, so the lazy-init guard behaves differently than in a non-transactional caller. This is a
|
||||
* known constraint of the test setup, not a bug in the production code.
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
@ActiveProfiles("test")
|
||||
@Import(PostgresContainerConfig.class)
|
||||
@@ -100,6 +111,7 @@ class DocumentLazyLoadingTest {
|
||||
}).doesNotThrowAnyException();
|
||||
results.forEach(d -> assertThat(d.getSender()).isNotNull());
|
||||
results.forEach(d -> assertThat(d.getSender().getLastName()).isNotNull());
|
||||
results.forEach(d -> assertThat(d.getTags()).isNotEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user