1 16 17 package org.springframework.jdbc.object; 18 19 import java.sql.ResultSet ; 20 import java.sql.SQLException ; 21 import java.util.Map ; 22 23 import javax.sql.DataSource ; 24 25 import org.springframework.jdbc.core.RowMapper; 26 27 51 public abstract class MappingSqlQueryWithParameters extends SqlQuery { 52 53 56 public MappingSqlQueryWithParameters() { 57 } 58 59 64 public MappingSqlQueryWithParameters(DataSource ds, String sql) { 65 super(ds, sql); 66 } 67 68 69 73 protected RowMapper newRowMapper(Object [] parameters, Map context) { 74 return new RowMapperImpl(parameters, context); 75 } 76 77 92 protected abstract Object mapRow(ResultSet rs, int rowNum, Object [] parameters, Map context) 93 throws SQLException ; 94 95 96 100 protected class RowMapperImpl implements RowMapper { 101 102 private final Object [] params; 103 104 private final Map context; 105 106 109 public RowMapperImpl(Object [] parameters, Map context) { 110 this.params = parameters; 111 this.context = context; 112 } 113 114 public Object mapRow(ResultSet rs, int rowNum) throws SQLException { 115 return MappingSqlQueryWithParameters.this.mapRow(rs, rowNum, this.params, this.context); 116 } 117 } 118 119 } 120 | Popular Tags |