Class JdbcUpdateAffectedIncorrectNumberOfRowsException

  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended byorg.springframework.core.NestedRuntimeException
                  extended byorg.springframework.dao.DataAccessException
                      extended byorg.springframework.dao.InvalidDataAccessResourceUsageException
                          extended byorg.springframework.dao.IncorrectUpdateSemanticsDataAccessException
                              extended byorg.springframework.jdbc.JdbcUpdateAffectedIncorrectNumberOfRowsException
All Implemented Interfaces:

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.

Rod Johnson
See Also:
Serialized Form

Field Summary
Fields inherited from class java.lang.RuntimeException
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.dao.IncorrectUpdateSemanticsDataAccessException
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getCause, getMessage, 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


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

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


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


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


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.

wasDataUpdated in class IncorrectUpdateSemanticsDataAccessException

Copyright (C) 2003-2004 The Spring Framework Project.