Package org.springframework.jdbc
Class JdbcUpdateAffectedIncorrectNumberOfRowsException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.dao.DataAccessException
org.springframework.dao.NonTransientDataAccessException
org.springframework.dao.InvalidDataAccessResourceUsageException
org.springframework.dao.IncorrectUpdateSemanticsDataAccessException
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 is an
 error if it affects multiple rows.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionJdbcUpdateAffectedIncorrectNumberOfRowsException(String sql, int expected, int actual) Constructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.
- 
Method SummaryModifier and TypeMethodDescriptionintReturn the number of rows that have actually been affected.intReturn the number of rows that should have been affected.booleanReturn whether data was updated.Methods inherited from class org.springframework.core.NestedRuntimeExceptioncontains, getMostSpecificCause, getRootCauseMethods inherited from class java.lang.ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
- 
Constructor Details- 
JdbcUpdateAffectedIncorrectNumberOfRowsExceptionConstructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.- Parameters:
- sql- the SQL we were trying to execute
- expected- the expected number of rows affected
- actual- the actual number of rows affected
 
 
- 
- 
Method Details- 
getExpectedRowsAffectedpublic int getExpectedRowsAffected()Return the number of rows that should have been affected.
- 
getActualRowsAffectedpublic int getActualRowsAffected()Return the number of rows that have actually been affected.
- 
wasDataUpdatedpublic boolean wasDataUpdated()Description copied from class:IncorrectUpdateSemanticsDataAccessExceptionReturn whether data was updated. If this method returnsfalse, there is nothing to roll back.The default implementation always returns true. This can be overridden in subclasses.- Overrides:
- wasDataUpdatedin class- IncorrectUpdateSemanticsDataAccessException
 
 
-