본문 바로가기
Framework/MyBatis

[MyBats/iBatis] insertList 정리

by 댓츠굿 2013. 9. 22.

기본적으로 오라클에서 INSERT ALL 을 제공해준다.


- INSERT ALL 예제 (출처: http://302.pe.kr/349 )



이 INSERT ALL 을 iBatis에서 적용해 볼 수 있다.


(출처: http://baeksupervisor.tistory.com/23)

단일 insert 할 때는 dao 단에서 map 을 통해 혹은 자바빈을 통해 인자를 넘겼다면
다중 insert 를 ibatis 에서 한번에 하려면. map 혹은 자바빈을 list 에 담아서 보내주면 된다.

당연히 list 의 각 row 에 해당하는 빈의 속성은 모든 row 가 동일해야 한다.




- iBatis List 형태 파라미터 insert List<Object>

출처: http://hdm6337.tistory.com/entry/iBatis-List-%ED%98%95%ED%83%9C-%ED%8C%8C%EB%9D%BC%EB%AF%B8%ED%84%B0-insert-ListObject




- 또다른 예제 MyBatis

출처: http://stackoverflow.com/questions/17563463/mybatis-insert-list-values




반응형