随笔-295  评论-26  文章-1  trackbacks-0
jt.execute("update owners set address = 'GuangZhou' where telephone = ?",
    new PreparedStatementCallback(){
     public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
      ps.setString(1, "16068008");
      ps.addBatch();
      ps.setString(1, "6085555487");
      ps.addBatch();
      return ps.executeBatch();
     }
  });
  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. publicinterfacePreparedStatementCallback {
  14.   /**
  15.    * 定义PreparedStatement中的执行内容。
  16.    * 执行前PreparedStatement的参数等内容都已经设置好了。
  17.    * @param stmt PreparedStatement
  18.    * @return 执行的结果
  19.    * @throws SQLException
  20.    */
  21.   publicObject doInPreparedStatement(PreparedStatement stmt) throwsSQLException;
  22. }


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

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


网站导航: