У меня есть JPA-репозиторий Spring Boot Data: [code] @Query(value = """ SELECT ....... """, nativeQuery = true) ProfileView findByCustomerId(......); [/code] Проекция: [code]public interface ProfileView {
String getRreference(); } [/code] Сделать запрос: [code]final ProfileView result = profileRepository.findByCustomerId(......); final String profile = result.getReference(); [/code] Я получаю сообщение об ошибке: [code]java.lang.NullPointerException: Cannot invoke "com.ProfileView.getReference()" because "result" is null [/code] У меня пустой результат SQL-запроса. Знаете ли вы, как я могу решить эту проблему? Мне нужен пустой профиль String без ошибки NPE.
Журналы, которые я получаю:
Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync
Я следил за тем, чтобы потреблять спокойную веб -службу
и запустил эту команду в терминале Intellij
./mvnw spring-boot:run
У меня была ошибка, поэтому я решил клонировать полный проект