Class Expectation.RowCount

java.lang.Object
org.hibernate.jdbc.Expectation.RowCount
All Implemented Interfaces:
Expectation
Enclosing interface:
Expectation

public static class Expectation.RowCount extends Object implements Expectation
Row count checking. A row count is an integer value returned by PreparedStatement.executeUpdate() or Statement.executeBatch(). The row count is checked against an expected value. For example, the expected row count for an INSERT statement is always 1.
Since:
6.5
  • Constructor Details

    • RowCount

      public RowCount()
  • Method Details

    • verifyOutcome

      public final void verifyOutcome(int rowCount, PreparedStatement statement, int batchPosition, String sql)
      Description copied from interface: Expectation
      Perform verification of the outcome of the JDBC operation based on the type of expectation defined, after execution of the given PreparedStatement. When a SQL statement is executed via PreparedStatement.executeUpdate(), verifyOutcome() is called exactly once. When Statement.executeBatch() is used to execute a batch update, this method is called once for each element of the batch.
      • The argument to rowCount is usually the number of table rows affected by execution of the SQL statement via executeUpdate(). However, in the case where executeBatch() is used to execute a batch update, it might be Statement.EXECUTE_FAILED or Statement.SUCCESS_NO_INFO.
      • The argument to batchPosition is negative unless executeBatch() is used to execute a batch update, in which case it is the position within the batch of the row count being verified.
      Specified by:
      verifyOutcome in interface Expectation
      Parameters:
      rowCount - The RDBMS reported "number of rows affected"
      statement - The statement representing the operation
      batchPosition - The position in the batch (if batching), or -1 if not part of a batch
      sql - The SQL backing the prepared statement, for error reporting and logging purposes
      See Also:
    • expectedRowCount

      protected int expectedRowCount()