In camel how i can update a result set coloumn to a value

1k Views Asked by At

My select query is

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

My Route is

<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>

My bean is

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;
    }
}

I want to update the result set processed column to done or some value.

I tried

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

But this does not update any values in the database. Why not?

1

There are 1 best solutions below

2
On

Can you try and change the query's named parameter notation to :# instead of just :

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