Top Description Inners Fields Constructors Methods
org.hibernate.jdbc

public Class Expectations

extends Object
Class Inheritance
Imports
java.sql.CallableStatement, .PreparedStatement, .SQLException, .Types, org.hibernate.HibernateException, .StaleStateException, org.hibernate.engine.jdbc.spi.SqlExceptionHelper, org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle, org.hibernate.exception.GenericJDBCException, org.hibernate.internal.CoreLogging, .CoreMessageLogger

Holds various often used Expectation definitions.
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
public static final Expectation
private static final CoreMessageLogger
public static final Expectation
public static final Expectation
private static SqlExceptionHelper
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Expectation
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BASICback to summary
public static final Expectation BASIC
LOGback to summary
private static final CoreMessageLogger LOG
NONEback to summary
public static final Expectation NONE
PARAMback to summary
public static final Expectation PARAM
sqlExceptionHelperback to summary
private static SqlExceptionHelper sqlExceptionHelper
USUAL_EXPECTED_COUNTback to summary
public static final int USUAL_EXPECTED_COUNT
USUAL_PARAM_POSITIONback to summary
public static final int USUAL_PARAM_POSITION

Constructor Detail

Expectationsback to summary
private Expectations()

Method Detail

appropriateExpectationback to summary
public static Expectation appropriateExpectation(ExecuteUpdateResultCheckStyle style)
org.hibernate.jdbc back to summary

public Class Expectations.BasicExpectation

extends Object
implements Expectation
Class Inheritance
All Implemented Interfaces
org.hibernate.jdbc.Expectation
Known Direct Subclasses
org.hibernate.jdbc.Expectations.BasicParamExpectation

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
protected
BasicExpectation(int expectedRowCount)

Method Summary

Modifier and TypeMethod and Description
public boolean
canBeBatched()

Implements org.hibernate.jdbc.Expectation.canBeBatched.

Is it acceptable to combiner this expectation with statement batching?
private void
checkBatched(int rowCount, int batchPosition, String statementSQL)

private void
checkNonBatched(int rowCount, String statementSQL)

protected int
determineRowCount(int reportedRowCount, PreparedStatement statement)

public int
prepare(PreparedStatement
The statement to be prepared
statement
)

Implements org.hibernate.jdbc.Expectation.prepare.

Perform any special statement preparation.
public final 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
)

Implements org.hibernate.jdbc.Expectation.verifyOutcome.

Perform verification of the outcome of the RDBMS operation based on the type of expectation defined.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

expectedRowCountback to summary
private final int expectedRowCount

Constructor Detail

BasicExpectationback to summary
protected BasicExpectation(int expectedRowCount)

Method Detail

canBeBatchedback to summary
public boolean canBeBatched()

Implements org.hibernate.jdbc.Expectation.canBeBatched.

Doc from org.hibernate.jdbc.Expectation.canBeBatched.

Is it acceptable to combiner this expectation with statement batching?

Returns:boolean

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

checkBatchedback to summary
private void checkBatched(int rowCount, int batchPosition, String statementSQL)
checkNonBatchedback to summary
private void checkNonBatched(int rowCount, String statementSQL)
determineRowCountback to summary
protected int determineRowCount(int reportedRowCount, PreparedStatement statement)
prepareback to summary
public int prepare(PreparedStatement statement) throws SQLException, HibernateException

Implements org.hibernate.jdbc.Expectation.prepare.

Doc from org.hibernate.jdbc.Expectation.prepare.

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 final void verifyOutcome(int rowCount, PreparedStatement statement, int batchPosition, String statementSQL)

Implements org.hibernate.jdbc.Expectation.verifyOutcome.

Doc from org.hibernate.jdbc.Expectation.verifyOutcome.

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

org.hibernate.jdbc back to summary

public Class Expectations.BasicParamExpectation

extends BasicExpectation
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
protected
BasicParamExpectation(int expectedRowCount, int parameterPosition)

Method Summary

Modifier and TypeMethod and Description
public boolean
canBeBatched()

Overrides org.hibernate.jdbc.Expectations.BasicExpectation.canBeBatched.

Implements org.hibernate.jdbc.Expectation.canBeBatched.

Is it acceptable to combiner this expectation with statement batching?
protected int
public int
prepare(PreparedStatement
The statement to be prepared
statement
)

Overrides org.hibernate.jdbc.Expectations.BasicExpectation.prepare.

Implements org.hibernate.jdbc.Expectation.prepare.

Perform any special statement preparation.
private CallableStatement
Inherited from org.hibernate.jdbc.Expectations.BasicExpectation:
verifyOutcome

Field Detail

parameterPositionback to summary
private final int parameterPosition

Constructor Detail

BasicParamExpectationback to summary
protected BasicParamExpectation(int expectedRowCount, int parameterPosition)

Method Detail

canBeBatchedback to summary
public boolean canBeBatched()

Overrides org.hibernate.jdbc.Expectations.BasicExpectation.canBeBatched.

Implements org.hibernate.jdbc.Expectation.canBeBatched.

Doc from org.hibernate.jdbc.Expectation.canBeBatched.

Is it acceptable to combiner this expectation with statement batching?

Returns:boolean

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

Annotations
@Override
determineRowCountback to summary
protected int determineRowCount(int reportedRowCount, PreparedStatement statement)

Overrides org.hibernate.jdbc.Expectations.BasicExpectation.determineRowCount.

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

Overrides org.hibernate.jdbc.Expectations.BasicExpectation.prepare.

Implements org.hibernate.jdbc.Expectation.prepare.

Doc from org.hibernate.jdbc.Expectation.prepare.

Perform any special statement preparation.

Parameters
statement:PreparedStatement

The statement to be prepared

Returns:int

The number of bind positions consumed (if any)

Annotations
@Override
Exceptions
SQLException:
Exception from the JDBC driver
HibernateException:
Problem performing preparation.
toCallableStatementback to summary
private CallableStatement toCallableStatement(PreparedStatement statement)