본문 바로가기

에러 해결

[Spring Boot] Using named parameters for method public abstract void '' but parameter not found in annotated query

Spring Boot JPA 오류

Using named parameters for method public abstract void '' but parameter not found in annotated query

 


해결

JpaRepository에서 쿼리문 사용시 데이터 @Param으로 연결

 

 

기존

@Transactional
    @Modifying
    @Query(value = "UPDATE users SET userName = :userName where userId = 1 ", nativeQuery = true)
    void user(String userName);

변경

@Transactional
    @Modifying
    @Query(value = "UPDATE users SET userName = :userName where userId = 1 ", nativeQuery = true)
    void user(@Param("userName")String userName);
반응형