HHH-7689 - Error executing batch should abort rest of batch for "cleanliness" sake
This commit is contained in:
parent
0e164d1c9d
commit
4a898c5524
|
@ -148,10 +148,10 @@ public abstract class AbstractBatchImpl implements Batch {
|
|||
@Override
|
||||
public final void execute() {
|
||||
notifyObserversExplicitExecution();
|
||||
if ( statements.isEmpty() ) {
|
||||
if ( getStatements().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
try {
|
||||
doExecuteBatch();
|
||||
}
|
||||
|
@ -159,24 +159,23 @@ public abstract class AbstractBatchImpl implements Batch {
|
|||
releaseStatements();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
statements.clear();
|
||||
|
||||
protected void releaseStatements() {
|
||||
for ( PreparedStatement statement : getStatements().values() ) {
|
||||
clearBatch( statement );
|
||||
jdbcCoordinator.release( statement );
|
||||
}
|
||||
getStatements().clear();
|
||||
}
|
||||
|
||||
private void releaseStatements() {
|
||||
for ( PreparedStatement statement : getStatements().values() ) {
|
||||
protected void clearBatch(PreparedStatement statement) {
|
||||
try {
|
||||
statement.clearBatch();
|
||||
jdbcCoordinator.release( statement );
|
||||
}
|
||||
catch ( SQLException e ) {
|
||||
LOG.unableToReleaseBatchStatement();
|
||||
LOG.sqlExceptionEscapedProxy( e );
|
||||
}
|
||||
}
|
||||
getStatements().clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to notify registered observers of an explicit execution of this batch.
|
||||
|
|
|
@ -71,7 +71,13 @@ public class NonBatchingBatch extends AbstractBatchImpl {
|
|||
throw e;
|
||||
}
|
||||
}
|
||||
getStatements().clear();
|
||||
|
||||
releaseStatements();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void clearBatch(PreparedStatement statement) {
|
||||
// no need to call PreparedStatement#clearBatch here...
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -804,9 +804,9 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
void splitQueries(String sourceQuery,
|
||||
int length);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "SQLException escaped proxy", id = 246)
|
||||
void sqlExceptionEscapedProxy(@Cause SQLException e);
|
||||
// @LogMessage(level = ERROR)
|
||||
// @Message(value = "SQLException escaped proxy", id = 246)
|
||||
// void sqlExceptionEscapedProxy(@Cause SQLException e);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "SQL Error: %s, SQLState: %s", id = 247)
|
||||
|
|
Loading…
Reference in New Issue