• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How Does it Work RowMapper

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I wanted to know when is the mapRow Method is been called.


Starts Here////

List userList=login.getLogindataList(bean.getUserName().trim(),encpassword);





public class ListRowMapper implements RowMapper
{
public Object mapRow(ResultSet rs, int rowNum) throws SQLException
{
Loginbean data = new Loginbean(rs.getInt(1),rs.getString(2));
return data;
}

ListRowMapper()
{
}


}


//////////////////////// Method //////////////

public List getLogindataList(String username,String password)
{
Object parms[]={username.toUpperCase(),password};
List noOfUsers = _jdbcTemplate.query("Select user_no,user_type from email.admin_user_master where upper(user_id) = ? and password = ?",parms, new ListRowMapper());
return noOfUsers;
}
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JdbcTemplate hides the normal regular plumbing code of jdbc. After the query is run a ResultSet is returned. In the JdbcTemplate, it will loop through the ResultSet and get a row, it will pass that row to the RowMapper class via the mapRow() method, along with which record number it is in the ResultSet.

That is all, it is called right after the query is run.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic