![[SpringBatch 연재 07] MyBatisPagingItemReader로 DB내용을 읽고, MyBatisItemWriter로 DB에 쓰기](https://devocean.sk.com/thumnail/2024/10/15/769e978e524bb2bf4859b98bf774b70bfa7fbebf1c9329d0d3d4c927120be898.png)
1
AI 요약
이 글은 AI가 원문을 분석하여 핵심 내용을 요약한 것입니다.
MyBatisPagingItemReader와 MyBatisBatchItemWriter를 활용한 Spring Batch 처리
이 게시물은 Spring Batch에서 MyBatisPagingItemReader를 사용하여 DB 데이터를 페이징 단위로 읽고 MyBatisBatchItemWriter를 통해 DB에 데이터를 쓰는 방법을 설명합니다.MyBatisPagingItemReader의 특징
- 간편한 설정과 쿼리 최적화 가능
- 동적 쿼리 지원
- SqlSessionFactory, QueryId, PageSize 등의 구성요소 필요
MyBatisBatchItemWriter의 특징
- MyBatis SQL 맵퍼를 통해 DB에 데이터 저장
- SqlSessionTemplate, StatementId 등의 구성요소 사용
- SQL 쿼리 분리로 유지보수 용이
샘플 구현 및 쿼리 작성
- Customer 도메인 모델 정의
- MyBatis XML 매퍼에 select 및 insert 쿼리 작성
- Spring Batch 설정에서 Reader, Writer, Step, Job 빈 등록