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
精彩评论