feat(transcription): findByMentionedPersons_PersonId derived query

Spring Data resolves the method name to a join over
transcription_block_mentioned_persons, returning every block whose sidecar
contains the given personId. The B-tree index on person_id (V56) keeps the
lookup O(log n) — required for the rename propagation that fans out to
every block referencing the renamed person, and for the future
"show all blocks mentioning person X" query on the person detail page.

The underscore between MentionedPersons and PersonId is the explicit
property-boundary form, immune to ambiguous longest-match parsing if the
embeddable later gains another nested object.

Refs #362

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-28 20:21:23 +02:00
parent 28112e1d7b
commit a2c633c5de

View File

@@ -29,6 +29,8 @@ public interface TranscriptionBlockRepository extends JpaRepository<Transcriptio
Optional<TranscriptionBlock> findByAnnotationId(UUID annotationId);
List<TranscriptionBlock> findByMentionedPersons_PersonId(UUID personId);
void deleteByAnnotationId(UUID annotationId);
int countByDocumentId(UUID documentId);