cmd창에서 insert시켰는데
STS에서 계속 select해오는거 값 못받아와서 의아해하다가.......
commit안시킨거였음..............5시간 넘게 걸렸는데.. 나는 커밋 바보가 틀림 없다
심각: Servlet.service() for servlet [appServlet] in context with path [/hotel] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'roomIndex' in 'class java.lang.Integer'] with root cause
org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'roomIndex' in 'class java.lang.Integer'
mapper에서의 리턴타입은 row 하나하나를 보고 적어야 합니다.
결과 값이 1건일 지 100건일지 모르기 때문에,
Dao에서 List으로 받을 건지 Map으로 받을건지 결정하는 것이고요.
selectList 또는 selectOne
단, Dao에서 selectOne으로 해 놓고선 결과값이 2건 이상 나올 경우
Mybatis에서 에러를 낸다라는거
java.lang.NullPointerException
at com.exe.dao.RoomDAO.getRoomLists(RoomDAO.java:65)
(해결법)
List lists=new ArrayList(); // 여기를 Lists lists = null; 이라고 해놨더니 계속 저 에러떴다.
for (int i=0; i<roomIndex.length; i++) {
RoomDTO dto =
sessionTemplate
.selectOne("hotelmapper.getRoomLists",roomIndex[i]);
if(dto != null)
lists.add(dto);
}
return lists;
기본적인 문법들좀 잊지 말자..
'개발 에러' 카테고리의 다른 글
톰캣 에러 (0) | 2019.12.09 |
---|---|
*2 (0) | 2019.12.09 |
3차 프로젝트 개념정리 [2019-11-20~2019-12-20] (4) | 2019.11.26 |