QueryService의 batchUpdate, batchRemove, batchInsert 사용 문의
안녕하세요.
QueryService를 사용하여 batchRemove 및 batchInsert를 사용하는데 문의사항이 있어 질문드립니다.
User Define DTO를 담은 ArrayList 형태의 리스트로 실행하였는데요, Exception이 발생하면서 동작하질 않네요.
세부 오류 내용은 이하와 같습니다.
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [..<비표시>..]
Error for batch element #1: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=4, TABLEID=307, COLNO=0, DRIVER=3.50.152; nested exception is com.ibm.db2.jcc.b.lm: Error for batch element #1: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=4, TABLEID=307, COLNO=0, DRIVER=3.50.152
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:228)
.... <중략>
물론 테이블 맵핑정의 및 Primary Key정보는 정확한지 확인했구요,
Batch방식이 아닌 Loop를 이용한 1건씩 remove, insert로는 동작에 이상이 없는것도 확인 했습니다.
실행한 간략환경은 이하와 같으며 누군가 도움 주시면 감사드리겠습니다.
- Java Version : 1.5
- DBMS : DB2 v.9
- Use Anyframe Core (query)
anyframe.core.query-3.1.1.jar
anyframe.core.query.ext-3.1.1.jar
anyframe.core.query.ria-3.1.1.jar
그럼 수고하세요.


QueryService의 batchUpdate, batchRemove, batchInsert 사용 문의
기술해주신 Exception 메시지만으로는 원인을 파악하기 힘들 것 같습니다.
실행한 테스트 코드, XML 파일, DTO 파일 정보를 보여 주시면 테스트 해 보도록 하겠습니다.
일반적으로 DB2 Version 9.5 환경에서 DTO List를 이용한 batchInsert, batchUpdate, batchRemove는 정상적으로 동작하는 것을 확인했습니다. 다음은 테스트 메소드에 대한 일부 내용입니다.
public void testBatchUpdateByObject() throws Exception { // 1. insert data by object batchInsertByObject(); // 2. set data for update ArrayList args = new ArrayList(); BatchTestVO batchTestVO = new BatchTestVO(); batchTestVO.setCol1("I1BatchCreateByObject"); batchTestVO.setCol2("Modified"); batchTestVO.setCol3(101); args.add(batchTestVO); batchTestVO = new BatchTestVO(); batchTestVO.setCol1("I2BatchCreateByObject"); batchTestVO.setCol2("Modified"); batchTestVO.setCol3(102); args.add(batchTestVO); batchTestVO = new BatchTestVO(); batchTestVO.setCol1("I3BatchCreateByObject"); batchTestVO.setCol2("Modified"); batchTestVO.setCol3(103); args.add(batchTestVO); // 3. execute query int[] rtVal = queryService.batchUpdate(args); assertTrue("Fail to batch update by object.", rtVal.length == 3); // 4. assert ArrayList rtList = (ArrayList) queryService.find("findBatchTest", new Object[] {}); assertTrue("Fail to find.", rtList.size() == initCount + 3); for (int i = 0; i < rtList.size(); i++) { Map result = (Map) rtList.get(i); assertEquals("Fail to batch update a specified column.", "Modified", result.get("col2")); } }DataSource 설정은 다음과 같습니다.
위 테스트 코드는 JDK 1.5, DB2 9.5, Anyframe Core 3.2.0 기반에서 테스트되었습니다.
Brand Coach Purses Outlet
Brand
Coach Purses Outlet
are one of the best handbags series in the market for females nowadays. TheCoach Factory Outlet
series do make ladies become more charming and outstanding if they choose the most suitable one, which could be used in a variety of occasions.Coach Factory Online
female will be the actuality the factCoach Outlet Online
that long-term history ofCoach Outlet Online
. No just one could deny the big accomplishment thatCoach Factory
made all through our existenceCoach outlet online
and will operateCoach Outlet Online
accomplishment toward future. We all knowCoach Outlet
has the great excellent as nicely as one ofCoach Factory Outlet
the most great factors they choose. OfCoach Outlet
instruction program this just one is worth to individualCoach handbags outlet
with very good good quality and awesome craftsmanshipcheap coach purses
.Coach Factory
New Arrivals are cozy productsCoach Factory Online
that occur to be fashionableCoach Factory Outlet
, fashionable and definitelyCoach Factory Outlet Online
practical. You can beginCoach Outlet Canada
searching during the craze ofCoach Outlet
New Arrivals andCoach Factory
carrying them is your individual characterCoach Factory Online
and style. TheyCoach Factory Outlet
may be utilized to fixtureCoach Factory Online
with diverse outfitsCheap Coach Purses
definitely. It might beDiscount Coach Handbags
the softness inside of the leatherdiscount coach purses
, the security inside ofCoach Outlet Online
the lock closureCoach Factory Online
, as correctlyCoach Factory Outlet Online
since the distinctiveCoach Factory
sort that providesCoach Outlet Online
about a woman to adoreCoach Outlet Store Online
New Arrivals. However, forCheap Coach handbags
just about any one, you can go toCoach Factory Outlet Online
over the internet shop to acquire for the variety,
Coach Factory
diversity and minimal priceCoach Factory Canada
. Coach Shoulder Bags developed of totally different elements are well-known as correctly since the leaders. BecauseCoach Factory Outlet
over the
Coach Factory Outlet Online
is so attainable due toCoach Purses Outlet
the fact of its decrease pricesCoach Outlet Store Online
, it has turn into among the most well-knownCoach Factory Online
to dateCoach Outlet Online Store
.