类 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
- 所有已实现的接口:
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.- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 JdbcUpdateAffectedIncorrectNumberOfRowsException(String sql, int expected, int actual)
Constructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
构造器详细资料
JdbcUpdateAffectedIncorrectNumberOfRowsException
public JdbcUpdateAffectedIncorrectNumberOfRowsException(String sql, int expected, int actual)
Constructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.- 参数:
sql
- SQL we were tring to executeexpected
- the expected number of rows affectedactual
- the actual number of rows affected
方法详细资料
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()
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.