随笔-295  评论-26  文章-1  trackbacks-0
  1. /**


  2. * Copyright: Copyright (c) 2005-2005
  3. * Company: JavaResearch(http://www.javaresearch.org)
  4. */
  5. package org.javaresearch.jerch;

  6. import java.sql.PreparedStatement;
  7. import java.sql.SQLException;

  8. /**
  9. * 设置PreparedStatement的参数的接口定义。
  10. * 最后更新日期:2005年3月28日
  11. * @author cherami
  12. */
  13. public interface PreparedStatementSetter {
  14.   /**
  15.    * 设置PreparedStatement所需的全部参数。
  16.    * @param ps PreparedStatement
  17.    * @throws SQLException
  18.    */
  19.   publicvoid setValues(PreparedStatement ps)  throwsSQLException;
  20. }
  21. jt.query("select address from owners where first_name = ? and last_name = ?",
        new PreparedStatementSetter(){
         public void setValues(PreparedStatement ps) throws SQLException {
          ps.setString(1, "Jeff");
          ps.setString(2, "Black");
         }
        },
        new RowMapper(){
         public Object mapRow(ResultSet rs, int rowNum) throws SQLException {      
          return rs.getString("address");
         }
        }));


大盘预测 国富论
posted on 2007-09-10 10:54 华梦行 阅读(3999) 评论(0)  编辑  收藏 所属分类: Spring

只有注册用户登录后才能发表评论。


网站导航: