세라공원

[spring ]MyBatis 오류: Invalid bound statement (not found) 본문

Error

[spring ]MyBatis 오류: Invalid bound statement (not found)

세라박 2022. 5. 13. 00:32

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 경로

 

<<경우의 수 >>

1) Mapper 인터페이스와 Mapper xml에 오타가 있을 때 

 ex) Mapper 인터페이스 함수와 Mapper xml의 id가 일치하지 않을 때

2) Mapper xml 경로가 잘못된 경우 (main/resources/디렉토리명)

-> 디렉토리가 여러개면 정확한 위치를 찾지 못하는 경우가 있기 때문에 한 개의 디렉토리씩만 만드는 것이 좋다.

 

해결 : namespace에 경로 지정을 잘못함.

mapper 인터페이스 방식은 namespace에 경로를 적어줘야 오류가 나지 않는다.

 <mapper namespace="com.community.sera.board.mapper.ReplyMapper">
  
   <!-- 댓글 등록 -->
  	<insert id="insert">
  		
  		insert into sera_reply (rno, bno, reply, replyer)
  		values (seq_reply.nextval, #{bno}, #{reply}, #{replyer})
  	
  	</insert>
  
  </mapper>

 

Comments