HHH-12878 Include the statement when a StaleStateException is thrown
This commit is contained in:
parent
858524cd27
commit
f8949f4abd
|
@ -48,14 +48,14 @@ public class Expectations {
|
||||||
public final void verifyOutcome(int rowCount, PreparedStatement statement, int batchPosition) {
|
public final void verifyOutcome(int rowCount, PreparedStatement statement, int batchPosition) {
|
||||||
rowCount = determineRowCount( rowCount, statement );
|
rowCount = determineRowCount( rowCount, statement );
|
||||||
if ( batchPosition < 0 ) {
|
if ( batchPosition < 0 ) {
|
||||||
checkNonBatched( rowCount );
|
checkNonBatched( rowCount, statement );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
checkBatched( rowCount, batchPosition );
|
checkBatched( rowCount, batchPosition, statement );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBatched(int rowCount, int batchPosition) {
|
private void checkBatched(int rowCount, int batchPosition, PreparedStatement statement) {
|
||||||
if ( rowCount == -2 ) {
|
if ( rowCount == -2 ) {
|
||||||
LOG.debugf( "Success of batch update unknown: %s", batchPosition );
|
LOG.debugf( "Success of batch update unknown: %s", batchPosition );
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,8 @@ public class Expectations {
|
||||||
throw new StaleStateException(
|
throw new StaleStateException(
|
||||||
"Batch update returned unexpected row count from update ["
|
"Batch update returned unexpected row count from update ["
|
||||||
+ batchPosition + "]; actual row count: " + rowCount
|
+ batchPosition + "]; actual row count: " + rowCount
|
||||||
+ "; expected: " + expectedRowCount
|
+ "; expected: " + expectedRowCount + "; statement executed: "
|
||||||
|
+ statement
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( expectedRowCount < rowCount ) {
|
if ( expectedRowCount < rowCount ) {
|
||||||
|
@ -79,10 +80,11 @@ public class Expectations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNonBatched(int rowCount) {
|
private void checkNonBatched(int rowCount, PreparedStatement statement) {
|
||||||
if ( expectedRowCount > rowCount ) {
|
if ( expectedRowCount > rowCount ) {
|
||||||
throw new StaleStateException(
|
throw new StaleStateException(
|
||||||
"Unexpected row count: " + rowCount + "; expected: " + expectedRowCount
|
"Unexpected row count: " + rowCount + "; expected: " + expectedRowCount
|
||||||
|
+ "; statement executed: " + statement
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( expectedRowCount < rowCount ) {
|
if ( expectedRowCount < rowCount ) {
|
||||||
|
|
Loading…
Reference in New Issue