站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

JdbcUpdateAffectedIncorrectNumberOfRowsException (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.jdbc
Class JdbcUpdateAffectedIncorrectNumberOfRowsException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.springframework.core.NestedRuntimeException
                  extended by org.springframework.dao.DataAccessException
                      extended by org.springframework.dao.InvalidDataAccessResourceUsageException
                          extended by org.springframework.dao.IncorrectUpdateSemanticsDataAccessException
                              extended by org.springframework.jdbc.JdbcUpdateAffectedIncorrectNumberOfRowsException
All Implemented Interfaces:
Serializable

public class JdbcUpdateAffectedIncorrectNumberOfRowsException
extends IncorrectUpdateSemanticsDataAccessException

Exception thrown when a JDBC update affects an unexpected number of rows. Typically we expect an update to affect a single row, meaning it's an error if it affects multiple rows.

Author:
Rod Johnson, Juergen Hoeller
See Also:
Serialized Form

Constructor Summary
JdbcUpdateAffectedIncorrectNumberOfRowsException(String sql, int expected, int actual)
          Constructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.
 
Method Summary
 int getActualRowsAffected()
          Return the number of rows that have actually been affected.
 int getExpectedRowsAffected()
          Return the number of rows that should have been affected.
 boolean wasDataUpdated()
          Return whether data was updated.
 
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getCause, getMessage, getMostSpecificCause, getRootCause, printStackTrace, printStackTrace
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JdbcUpdateAffectedIncorrectNumberOfRowsException

public JdbcUpdateAffectedIncorrectNumberOfRowsException(String sql,
                                                        int expected,
                                                        int actual)
Constructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.

Parameters:
sql - SQL we were tring to execute
expected - the expected number of rows affected
actual - the actual number of rows affected
Method Detail

getExpectedRowsAffected

public int getExpectedRowsAffected()
Return the number of rows that should have been affected.


getActualRowsAffected

public int getActualRowsAffected()
Return the number of rows that have actually been affected.


wasDataUpdated

public boolean wasDataUpdated()
Description copied from class: IncorrectUpdateSemanticsDataAccessException
Return whether data was updated. If this method returns false, there's nothing to roll back.

The default implementation always returns true. This can be overridden in subclasses.

Overrides:
wasDataUpdated in class IncorrectUpdateSemanticsDataAccessException

The Spring Framework

Copyright © 2002-2007 The Spring Framework.