본문 바로가기
spring

spring mapper update return type

by 신방동불주먹 2023. 2. 5.

insert, update, delete에는 resultType이 없고 row의 개수를 반환한다. 

 

ex) mapper에서 쓰인 아래 구문이

<update id="appTest">

update ~ set ~ 

</update>

 

controller에 와서

int a = service.appTest(~)

a = update 성공한 행의 개수를 반환하게 된다. 

 

 

- insert의 경우는 삽입된 행의 개수를 반환

- update의 경우는 수정에 성공한 행의 개수를 반환(실패시 0 반환)

- delete의 경우는 삭제한 행의 개수를 반환

'spring' 카테고리의 다른 글

유효 세션 확인 방법  (0) 2023.02.10
@ResponseBody  (0) 2023.02.06
Ajax return 후 submit 막기  (0) 2023.02.04
mybatis  (0) 2023.01.11
AOP(Aspect Oriented Programming)  (0) 2023.01.06