Package org.hibernate.jdbc
Interface Expectation
-
- All Known Implementing Classes:
Expectations.BasicExpectation
,Expectations.BasicParamExpectation
public interface Expectation
Defines an expected DML operation outcome.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
canBeBatched()
Is it acceptable to combine this expectation with statement batching?default int
getNumberOfParametersUsed()
The number of parameters this expectation implies.int
prepare(PreparedStatement statement)
Perform any special statement preparation.void
verifyOutcome(int rowCount, PreparedStatement statement, int batchPosition, String statementSQL)
Perform verification of the outcome of the RDBMS operation based on the type of expectation defined.
-
-
-
Method Detail
-
canBeBatched
boolean canBeBatched()
Is it acceptable to combine this expectation with statement batching?- Returns:
- True if batching can be combined with this expectation; false otherwise.
-
getNumberOfParametersUsed
default int getNumberOfParametersUsed()
The number of parameters this expectation implies. E.g.,Expectations.BasicParamExpectation
requires a single OUT parameter for reading back the number of affected rows.
-
verifyOutcome
void verifyOutcome(int rowCount, PreparedStatement statement, int batchPosition, String statementSQL) throws SQLException, HibernateException
Perform verification of the outcome of the RDBMS operation based on the type of expectation defined.- Parameters:
rowCount
- The RDBMS reported "number of rows affected".statement
- The statement representing the operationbatchPosition
- The position in the batch (if batching)statementSQL
- The SQL backing the prepared statement, for logging purposes- Throws:
SQLException
- Exception from the JDBC driverHibernateException
- Problem processing the outcome.
-
prepare
int prepare(PreparedStatement statement) throws SQLException, HibernateException
Perform any special statement preparation.- Parameters:
statement
- The statement to be prepared- Returns:
- The number of bind positions consumed (if any)
- Throws:
SQLException
- Exception from the JDBC driverHibernateException
- Problem performing preparation.
-
-