在驼峰中我如何将结果集coloumn更新为值

时间:2016-01-21 12:48:41

标签: apache-camel camel-sql

我的选择查询是

sql.selectOrder=select STID,CLLTR from GSI_DEVL.POLLUX_DATA WHERE PROCESSED='FALSE'

我的路线是

<route id="markRowsAsProcessed-Route"  >
         <!--    <from uri="timer://markRowsAsProcessed?delay=5000"/>-->
        <from uri="sqlComponent:{{sql.selectOrder}}?consumer.useIterator=false" />   
        <doTry>
              <to uri="bean:rowProcessController"/>  
            <to uri="sqlComponent:{{sql.markRows}}?batch=true"/>
            <doCatch>
                <exception>java.sql.SQLException</exception>    
                <exception>java.lang.IllegalStateException</exception>
                <exception>java.sql.SQLException</exception>
                <exception>java.lang.ClassCastException</exception> 
            </doCatch>
        </doTry>    
    </route>

我的豆子是

public class RowProcessController {
    List<Map<String, Object>> stationUnMarkedList = new ArrayList<Map<String, Object>>();
    List<Map<String, Object>> stationMarkedList = new ArrayList<Map<String, Object>>();
    Map<String,Object> stationMap = null;

    @SuppressWarnings("unchecked")
    @Handler
    public List<Map<String, Object>> markRowAsProcessed(Exchange exchange)
    {
        stationUnMarkedList = (List<Map<String, Object>>)exchange.getIn().getBody();
        for(Map<String,Object> data: stationMarkedList) {
            System.out.println(data.get("STID"));
            stationMap=new HashMap<String,Object>();
            stationMap.put("stationId", ((String)data.get("STID")));
            stationMap.put("callLetter", ((String)data.get("CLLTR")));
            stationMarkedList.add(stationMap);
        }
        return stationMarkedList;
    }
}

我想将结果集处理列更新为完成或某些值。

我试过了

sql.markRows=UPDATE POLLUX_DATA SET PROCESSED='DONE' where stid=:stationId

但是这不会更新数据库中的任何值。为什么不呢?

1 个答案:

答案 0 :(得分:0)

您可以尝试将查询的命名参数表示法更改为:#而不仅仅是:

sql.markRows = UPDATE POLLUX_DATA SET PROCESSED =&#39; DONE&#39; stid =:#stationId