1 21 package net.mlw.vlh.adapter.jdbc.spring; 22 23 import java.sql.ResultSet ; 24 import java.sql.SQLException ; 25 import java.util.ArrayList ; 26 import java.util.List ; 27 28 import net.mlw.vlh.ValueListInfo; 29 import net.mlw.vlh.adapter.jdbc.AbstractJdbcAdapter; 30 import net.mlw.vlh.adapter.jdbc.spring.util.SpringConnectionCreator; 31 32 import org.springframework.jdbc.core.RowMapper; 33 34 40 public class SpringDaoValueListAdapter extends AbstractJdbcAdapter 41 { 42 private RowMapper rowMapper; 43 44 public SpringDaoValueListAdapter() 45 { 46 setConnectionCreator(new SpringConnectionCreator()); 47 } 48 49 52 public List processResultSet(String name, ResultSet result, int numberPerPage, ValueListInfo info) throws SQLException 53 { 54 List list = new ArrayList (); 55 56 for (int rowIndex = 0; result.next() && rowIndex < numberPerPage; rowIndex++) 57 { 58 list.add(rowMapper.mapRow(result, rowIndex)); 59 } 60 61 return list; 62 } 63 64 67 public RowMapper getRowMapper() 68 { 69 return rowMapper; 70 } 71 72 75 public void setRowMapper(RowMapper rowMapper) 76 { 77 this.rowMapper = rowMapper; 78 } 79 } | Popular Tags |