Package st.orm

Class UnexpectedRowCountException

All Implemented Interfaces:
Serializable

public class UnexpectedRowCountException extends PersistenceException
Thrown when a write affects a different number of rows than it expects: an insert, update or remove of an entity that affects no row, or a batch whose affected row count differs from its size.

Storm detects this after the statement ran, so it passes through the template's exception mapper like a failure the database reported. An update of a versioned entity that affects no row is an OptimisticLockException instead.

Since:
1.16
See Also:
  • Constructor Details

    • UnexpectedRowCountException

      public UnexpectedRowCountException(String message, int expectedRowCount, int actualRowCount)
      Constructs a new exception with the specified detail message and row counts.
      Parameters:
      message - the detail message.
      expectedRowCount - the number of rows the write expected to affect.
      actualRowCount - the number of rows the write affected.
  • Method Details

    • getExpectedRowCount

      public int getExpectedRowCount()
      Returns the number of rows the write expected to affect.
      Returns:
      the expected row count.
    • getActualRowCount

      public int getActualRowCount()
      Returns the number of rows the write affected, as the driver reported it. For a batch, this is the sum of the counts the driver reported per statement.
      Returns:
      the actual row count.