Development/에러 해결 3

[MyBatis] MyBatis로 조회시 attempted to return null from a method with a primitive return type (int).

데이터를 조회하다가 attempted to return null from a method with a primitive return type (int).라는 메시지가 콘솔에 찍혔다. 즉, 내가 반환받는 타입은 int형인데 조회한 데이터가 조건에 맞지않아 조회가 되지않아서 null을 반환하는 것.. public int selectUserNm(HashMap param) throws Exception { return loginDao.selectUserNm(param); } 위에 사진을 보면 int형으로 반환을 받도록 되어있다.. int형으로는 null을 받아 낼 수없어 아래와 같이 Integer로 수정해서 반영했다. public Integer selectUserNm(HashMap param) throws Ex..

[MyBatis] MyBatis로 조회시 Expected one result (or null) to be returned by selectOne(), but found: 2

데이터를 조회하다가 Expected one result (or null) to be returned by selectOne(), but found: 2라는 메시지가 콘솔에 찍혀있는것을 보았다. 이말은 즉, 리턴된 결과는 1개 혹은 0 이어야 하는데 두개이상이 리턴되고 있다는 것... 그래서 해당 쿼리를 직접 데이터베이스에 들어가 조회를 했더니 아래처럼 결과가 나왔다. 사진과 같이 조회결과가 2개의 행이 나오고 말았다.. 결국 쿼리를 반환해서 리턴받는 곳인 service쪽을 찾아보게 되었는데 아래와 같이 선언되어 있었고 public int selectUserNm(HashMap param) throws Exception { return loginDao.selectUserNm(param); } 리턴을 2개 이..

[MyBatis] MyBatis로 조회할 때 It's likely that neither a Result Type nor a Result Map was specified.

Spring + Mybatis 개발환경으로 개발하다가 select구문으로 조회를 하려고 하니 갑자기 에러가 떴다. 무슨 에러인지 확인하려고 콘솔창을 보니까 It's likely that neither a Result Type nor a Result Map was specified. 라는 메시지가 찍혀있었다. 즉, 결과 유형이나 결과 맵이 지정되지 않았을 가능성이 있습니다. 라는 뜻인데 어느 부분에서 에러가 나는건지 확인을 하러 소스를 찾아봤다. 결국 찾다가 발견한 곳은 sql구문이 적혀있는 mapper.xml쪽... SELECT user_nm FROM user_login_mngt WHERE user_nm = #{USER_NM} xml 소스를 보면 parameterType은 정의를 해놨지만 resu..