Framework/__Spring

How to do batch with Spring using Ibatis

javamix 2008. 4. 2. 14:45
        getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
            public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
                executor.startBatch();         
                executor.insert("set",               param);
                executor.update("modify",         param);               
                return executor.executeBatch();
            }
        });

        getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
            public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
                executor.startBatch();        
               
                //do Ibaatis operations here
                for(int i = 0; i < sList.size(); i ++){
                       insert("set",               param);
                }
                return executor.executeBatch();
            }
        });