Dave, thank you so much for your valuable advice..and yes it solves my problem. Here is what I do to solve the problem:
Code:
public class NoWorkFriendlyItemReader extends IbatisDrivingQueryItemReader{
private static Log log = LogFactory.getLog(NoWorkFriendlyItemReader.class);
private boolean noWorkFound= false;
public void open(ExecutionContext executionContext) {
try{
super.open(executionContext);
}catch(NoWorkFoundException e){
log.info("no work found, skipping to the next step if any");
noWorkFound= true;
}
}
public Object read() {
if(noWorkFound)
return null;
else
return super.read();
}
}
I created NoWorkFriendlyItemReader that will simply return null in case if there's no work found. It solves my problem but if anyone have a comments or better approach, I would love to hear it from you.
IMHO, this shld be the default behaviour for the batchjob framework or probably we shld put it as a configurable behaviour. It would be lovely if we hv something like this:
Code:
...
<bean id="step-2" parent="simpleStep">
...
<property name="errorOnNoWorkFound" value="false"/>
</bean>
...
Thank you once again and I can't wait for the ver.1.1 to release soon