org.hibernate.query.QueryTypeMismatchException: Specified result type [java.lang.String] did not match Query selection type [com.ssafy.ssap.domain.qna.ArticleImage] - multiple selections: use Tuple or array
@Repository
public interface ArticleImageRepository extends JpaRepository<ArticleImage, Integer> {
List<String> findAllImagePathByQuestionId(Integer questionNo);
List<String> findAllImagePathByAnswerId(Integer answerNo);
}
try{
switch(pattern){
case "question" -> urlList = articleImageRepository.findAllImagePathByQuestionId(id);
case "answer" -> urlList = articleImageRepository.findAllImagePathByAnswerId(id);
default -> throw new NullPointerException();
}
resultMap.put("urlList",urlList);
return resultMap;
}catch(NullPointerException e){
same errors' occuring at AlarmRepository so i thought it's something Structual Mistake I can solve it with just using Entity by using 'findById(id)' method, but i want to know what problem is.
error message is saying my 'repository.findBy~' method(or query) is returning Class Entity(not column Entity) but i can't find any mistakes i've done on JPA grammar. (and it occurs twice same) please let me know to improve more Thank YOU
i did change return type of repository method to String[] but it also did not work
adding my Domain Class
@Column(name = "image_path")
@Lob
private String imagePath;