| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 31 |
Tags
- 자바스크립트
- nodejs
- node
- 백준
- javascript
- 리뷰
- Spring Boot
- effective
- 자바
- Git
- jface
- Web
- 알고리즘
- 후기
- java8
- 엘라스틱서치
- java
- Spring
- RCP
- elasticsearch
- JPA
- boot
- 스프링
- kibana
- 인터페이스
- 독후감
- MySQL
- error
- 맛집
- 이펙티브
Archives
- Today
- Total
wedul
Mybatis에서 parameterType을 List로 insert하기 본문
반응형
Mybatis에서
parameterType을 List로 지정하여 쿼리를 수행하고 싶은 경우 다음과 같이 진행한다,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | // 전송 데이터 형식 List<AccountDto> accouts = new ArrayList<>(); accounts.add(new AccountDto("wedul", 123); accounts.add(new AccountDto("cjung", 456); accountDao.insertAccounts(accounts); // Mybatis <insert id="insert" parameterType="java.util.List"> INSERT INTO account( id, age ) VALUES <foreach item="item" index="index" collection="list"> ( #{item.id} ,#{item.age} ) </foreach> </insert> | cs |
반응형
'web > Spring' 카테고리의 다른 글
| Aop 설명과 설정방법 (0) | 2018.05.27 |
|---|---|
| 스프링 실행 시 실행 되는 부분 (1) | 2018.05.27 |
| Spring 프로젝트에서 src/main/resource 경로에 파일접근 방법 (0) | 2018.05.27 |
| 외부 properties 파일을 이용해서 스프링 빈을 생성하는 방법 (0) | 2018.05.27 |
| java.lang.Error: Unresolved compilation problem (0) | 2018.05.27 |
