开发者

Spring batch datareader returns extra null object on end of collection of read items?

I'm u开发者_Python百科sing Spring batch - using datareaders to load up lists of items. For each of my readers, they all return an extra null object on the end of the list.

Has anybody seen this before? What am I doing wrong?


It's the normal behavior.

A reader stops on a null element. But to find a null element, you must find it. As a consequence, the null element is issued, but it will the last one and the writer won't be called.


It sounds like you were implementing the read() method from the ItemReader http://static.springsource.org/spring-batch/apidocs/org/springframework/batch/item/ItemReader.html

What you want to do is implement the readCursor(ResultSet rs, int currentRow) method from the JdbcCursorItemTeader - this will stop this behaviour. http://static.springsource.org/spring-batch/apidocs/org/springframework/batch/item/database/JdbcCursorItemReader.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜