Hi,
Can somebody please post an example of how to use JdbcPagingItemReader? The documentation only lists an XML snippet without the consumer code that uses it.
Regards,
Shantanu
Hi,
Can somebody please post an example of how to use JdbcPagingItemReader? The documentation only lists an XML snippet without the consumer code that uses it.
Regards,
Shantanu
Check out the XML configuration on this post
http://forum.springsource.org/showth...edSQLException
You shouldn't normally use it in java code. You should tie it in XML that that sends it to a processor and then a writer.
IF you did want to use it in java code.. here you go:
Code:private JdbcPagingItemReader<Person> personReader public void setPersonReader( JdbcPagingItemReader<Person> personReader) { this.personReader = personReader; } public void myMethod() { Person p = personReader.read(); while ( p != null) { System.out.println(p); p = personReader.read(); } }
Bwawok,
Thanks for the tip. I think I have not understood fully how is this feature intended to be used. I want to use this in non-batch environments -- e.g. can I use this for pagination of data records on web pages? How can I jump to a certain page (can I load a page on-demand)?
In the code example in the post above, it seems the rows are supposed to be read sequentially! What if I want to switch back and forth between pages?
Regards,
Shantanu