Top Description Fields Constructors Methods
org.springframework.jdbc

public Class JdbcUpdateAffectedIncorrectNumberOfRowsException

extends IncorrectUpdateSemanticsDataAccessException
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
org.springframework.dao.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.
Authors
Rod Johnson, Juergen Hoeller

Field Summary

Modifier and TypeField and Description
private final int
actual

Number of rows that actually were affected.

private final int
expected

Number of rows that should have been affected.

Constructor Summary

AccessConstructor and Description
public
JdbcUpdateAffectedIncorrectNumberOfRowsException(String
the SQL we were trying to execute
sql
,
int
the expected number of rows affected
expected
,
int
the actual number of rows affected
actual
)

Constructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.

Method Summary

Modifier and TypeMethod and Description
public int
getActualRowsAffected()

Return the number of rows that have actually been affected.

public int
getExpectedRowsAffected()

Return the number of rows that should have been affected.

public boolean

Field Detail

actualback to summary
private final int actual

Number of rows that actually were affected.

expectedback to summary
private final int expected

Number of rows that should have been affected.

Constructor Detail

JdbcUpdateAffectedIncorrectNumberOfRowsExceptionback to summary
public JdbcUpdateAffectedIncorrectNumberOfRowsException(String sql, int expected, int actual)

Constructor for JdbcUpdateAffectedIncorrectNumberOfRowsException.

Parameters
sql:String

the SQL we were trying to execute

expected:int

the expected number of rows affected

actual:int

the actual number of rows affected

Method Detail

getActualRowsAffectedback to summary
public int getActualRowsAffected()

Return the number of rows that have actually been affected.

getExpectedRowsAffectedback to summary
public int getExpectedRowsAffected()

Return the number of rows that should have been affected.

wasDataUpdatedback to summary
public boolean wasDataUpdated()

Overrides org.springframework.dao.IncorrectUpdateSemanticsDataAccessException.wasDataUpdated.

Doc from org.springframework.dao.IncorrectUpdateSemanticsDataAccessException.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.

Annotations
@Override