Top Description Methods
org.hibernate.jdbc

public Interface Expectation

Known Direct Implementers
org.hibernate.jdbc.Expectations.BasicExpectation
Imports
java.sql.PreparedStatement, .SQLException, org.hibernate.HibernateException

Defines an expected DML operation outcome.
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if batching can be combined with this expectation; false otherwise.
canBeBatched
()

Is it acceptable to combine this expectation with statement batching?

public default int
getNumberOfParametersUsed()

The number of parameters this expectation implies.

public int

Returns:

The number of bind positions consumed (if any)
prepare
(PreparedStatement
The statement to be prepared
statement
)

Perform any special statement preparation.

public void
verifyOutcome(int
The RDBMS reported "number of rows affected".
rowCount
,
PreparedStatement
The statement representing the operation
statement
,
int
The position in the batch (if batching)
batchPosition
,
String
The SQL backing the prepared statement, for logging purposes
statementSQL
)

Perform verification of the outcome of the RDBMS operation based on the type of expectation defined.

Method Detail

canBeBatchedback to summary
public boolean canBeBatched()

Is it acceptable to combine this expectation with statement batching?

Returns:boolean

True if batching can be combined with this expectation; false otherwise.

getNumberOfParametersUsedback to summary
public 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.

prepareback to summary
public int prepare(PreparedStatement statement) throws SQLException, HibernateException

Perform any special statement preparation.

Parameters
statement:PreparedStatement

The statement to be prepared

Returns:int

The number of bind positions consumed (if any)

Exceptions
SQLException:
Exception from the JDBC driver
HibernateException:
Problem performing preparation.
verifyOutcomeback to summary
public 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:int

The RDBMS reported "number of rows affected".

statement:PreparedStatement

The statement representing the operation

batchPosition:int

The position in the batch (if batching)

statementSQL:String

The SQL backing the prepared statement, for logging purposes

Exceptions
SQLException:
Exception from the JDBC driver
HibernateException:
Problem processing the outcome.