Class SQLStatementCountValidator

java.lang.Object
io.hypersistence.utils.jdbc.validator.SQLStatementCountValidator

public class SQLStatementCountValidator extends Object
SQLStatementCountValidator - Validates recorded statements count. First you execute some operations against your database and then you check how many statements were executed. This is a useful tool against the "N+1" problem or suboptimal DML statements.

For more details about how to use it, check out this article on vladmihalcea.com.

Since:
3.0.2
Author:
Vlad Mihalcea
  • Method Details

    • reset

      public static void reset()
      Reset the statement recorder
    • assertSelectCount

      public static void assertSelectCount(int expectedCount)
      Assert select statement count
      Parameters:
      expectedCount - expected select statement count
    • assertInsertCount

      public static void assertInsertCount(int expectedCount)
      Assert insert statement count
      Parameters:
      expectedCount - expected insert statement count
    • assertUpdateCount

      public static void assertUpdateCount(int expectedCount)
      Assert update statement count
      Parameters:
      expectedCount - expected update statement count
    • assertDeleteCount

      public static void assertDeleteCount(int expectedCount)
      Assert delete statement count
      Parameters:
      expectedCount - expected delete statement count
    • assertTotalCount

      public static void assertTotalCount(int expectedCount)
      Assert the total statement count
      Parameters:
      expectedCount - expected total statement count