File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Difference between RowCallbackHandler and RowMapper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Difference between RowCallbackHandler and RowMapper" Watch "Difference between RowCallbackHandler and RowMapper" New topic
Author

Difference between RowCallbackHandler and RowMapper

Neha Sen
Greenhorn

Joined: May 27, 2009
Posts: 20
What is difference between RowCallbackHandler and RowMapper?
aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
Both RowCallBackHandler and RowMapper are both for retrieving the results from a ResultSet which takes the responsibility to process each row of data in the ResultSet. Both interface methods should not call next() on the ResultSet. It requires to extract values of the current row and process the data on per-row basis.

RowCallBackHandler's processRow(ResultSet rs) does not return object which is having the result.If require it can store the result in its instance variable and then make it available it to DAO but for this it requires to be designed as stateful.
So this type of method(processRow()) is generally implemented to process the result like preparing XML document with the result data.

But RowMapper's mapRow(ResultSet rs, int rowNum) can return an Object representing the result object for the current row.
In general this interface is designed as stateless to make it reusable and reduce the memory requirements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between RowCallbackHandler and RowMapper
 
Similar Threads
difference RAD & WSAD
Difference between wsad5.1.2 & Rad
Which Method use and how to store data in List after get the data
JATO Vs JDOM
Run as AWT or SWT Application Eclipse Question