본문 바로가기
오류 해결

[Mybatis] BindingException

by 쿠쿠씨 2022. 5. 9.
반응형

 

오류 메시지

Request processing failed; nested exception is org.apache.ibatis.binding.BindingException:

Invalid bound statement (not found): com.mycompany.idev.mapper.QuestionMapper.getPageList

 

원인

root-context.xml 파일의 mapperLocations에 매퍼 XML 파일이 위치한 경로를 정의하지 않아서 오류가 발생했다.

<property name="mapperLocations">
	<list>
		<value>classpath:META-INF/mybatis/member.xml</value>
		<value>classpath:META-INF/mybatis/notice.xml</value>
		<value>classpath:META-INF/mybatis/performance.xml</value>
	</list>
</property>

 

해결 방법

root-context.xml 파일에 매퍼 XML 파일의 경로를 정의합니다. (question.xml)

<property name="mapperLocations">
	<list>
		<value>classpath:META-INF/mybatis/member.xml</value>
		<value>classpath:META-INF/mybatis/notice.xml</value>
		<value>classpath:META-INF/mybatis/performance.xml</value>
		<value>classpath:META-INF/mybatis/question.xml</value>
	</list>
</property>

 

 


+추가

 

 

오류 메시지

Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingExceptionParameter 'start_time' not found. Available parameters are [perform_date, param3, perform_idx, param1, param2, start_date]

 

원인

Mapper 인터페이스에서 @Param으로 파라미터 이름을 잘못 지정했다.

int getIdx(@Param("perform_idx") int perform_idx ,@Param("start_date") String start_date);

 

해결 방법

파라미터 이름을 수정하였습니다.

int getIdx(@Param("perform_idx") int perform_idx, @Param("start_time") String start_time);

 

 

++추가

오류 메시지

BindingException: Parameter 'theater_idx' not found. Available parameters are [arg1, arg0, param1, param2]

 

원인

Mapper 인터페이스에서 파라미터를 읽지 못한다.

int leftSeat(int theater_idx, int schedule_idx);

 

해결 방법

Mapper 인터페이스에서 파라미터 앞에 @Param 어노테이션을 추가합니다.

int leftSeat(@Param("theater_idx") int theater_idx, @Param("schedule_idx") int schedule_idx);

 

반응형

댓글