fix(search): handle null firstName in all search queries
Use COALESCE to convert null firstName to empty string in: - PersonRepository.searchByName (JPQL) - PersonRepository.searchWithDocumentCount (native SQL) - PersonRepository.findCorrespondentsWithFilter (native SQL) - DocumentSpecifications.hasText (Criteria API, sender + receiver) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -440,4 +440,26 @@ class PersonRepositoryTest {
|
||||
assertThat(results).hasSize(1);
|
||||
assertThat(results.get(0).getLastName()).isEqualTo("Cram");
|
||||
}
|
||||
|
||||
// ─── null firstName handling ────────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
void searchByName_findsPersonWithNullFirstName() {
|
||||
personRepository.save(Person.builder().lastName("Gesellschafter des Verlages").build());
|
||||
|
||||
List<Person> result = personRepository.searchByName("Gesellschafter");
|
||||
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.get(0).getLastName()).isEqualTo("Gesellschafter des Verlages");
|
||||
}
|
||||
|
||||
@Test
|
||||
void searchWithDocumentCount_findsPersonWithNullFirstName() {
|
||||
personRepository.save(Person.builder().lastName("Gesellschafter des Verlages").build());
|
||||
|
||||
List<PersonSummaryDTO> result = personRepository.searchWithDocumentCount("Gesellschafter");
|
||||
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.get(0).getLastName()).isEqualTo("Gesellschafter des Verlages");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user