Chinaunix首页 | 论坛 | 博客
  • 博客访问: 546487
  • 博文数量: 17
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 2325
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-26 16:15
文章分类

全部博文(17)

文章存档

2008年(17)

我的朋友

分类: Java

2008-06-25 14:25:42

About getJdbcTemplate().update(..)

yael,
From , the method update clearly documented that if there is any error, there will be an exception thrown: DataAccessException. Catching that will signify errors.

The return code from update means you have a successful run of the update. but the value will depends on what type of update SQL you used. Some SQL will run sucessful, but return 0, and some will return number or records got affected. That you will have to read on your Database manual to figure out.

对于不同的DB这是个问题。但是我看过上面的链接,其中说明如下,看来是可以一试的:

update

public int update( sql)
throws
Description copied from interface:
Issue a single SQL update operation (such as an insert, update or delete statement).

Specified by:
in interface
Parameters:
sql - static SQL to execute
Returns:
the number of rows affected
Throws:
- if there is any problem.


阅读(18098) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~