반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- MSsql
- node.js
- git
- Push
- Maven
- MariaDB
- nodejs
- centos7
- Next.js
- jquery
- jenkins
- PM2
- popup
- ajax
- security
- spring3
- mysql
- config
- pwa
- Eclipse
- rocky9
- FCM
- Java
- mybatis
- yona
- SpringBoot
- javascript
- NextJS
- Tomcat
- docker
Archives
- Today
- Total
종이 한장 차이...
mybatis+select count() resultType 본문
728x90
반응형
SMALL
Spring MVC에서 select count() 시 mybatis설정 및 resultType 참고.
- Dao 쿼리 결과를 Object로 받은 후 int로 리턴.
public int getUserCount(userInfoVO params) {
Object obj = selectOne("selectUserCount");
return obj == null ? 0 : (Integer) obj;
}
- mybatis에서 resultType을 Integer로 설정.
<select id="selectUserCount" resultType="Integer">
SELECT COUNT(*) FROM USERINFO with(nolock)
WHERE user_code = #{userCode};
</select>
728x90
반응형
LIST
'Spring' 카테고리의 다른 글
Spring3 @Transactional rollbackFor = {Exception.class} 사용시 참고 (2) | 2023.12.04 |
---|---|
mybatis INSERT 후 PK(자동생성된ID) 반환 받기(useGeneratedKeys) (0) | 2023.11.27 |
JsonData를 VO model로 바로 받을때...참고 (0) | 2023.07.07 |
browser type check by JAVA (0) | 2023.06.08 |
Springboot2.x Web 프로젝트 설정 1(프로젝트 생성 및 JSP설정) (0) | 2023.05.08 |
Comments