• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mybatis / mybatis-3 / #3636

25 May 2024 01:05PM CUT coverage: 87.169%. Remained the same
#3636

Pull #3170

github

web-flow
chore(deps): update dependency maven to v3.9.7
Pull Request #3170: chore(deps): update dependency maven to v3.9.7

3537 of 4285 branches covered (82.54%)

9389 of 10771 relevant lines covered (87.17%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/apache/ibatis/executor/BatchExecutorException.java
1
/*
2
 *    Copyright 2009-2023 the original author or authors.
3
 *
4
 *    Licensed under the Apache License, Version 2.0 (the "License");
5
 *    you may not use this file except in compliance with the License.
6
 *    You may obtain a copy of the License at
7
 *
8
 *       https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *    Unless required by applicable law or agreed to in writing, software
11
 *    distributed under the License is distributed on an "AS IS" BASIS,
12
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *    See the License for the specific language governing permissions and
14
 *    limitations under the License.
15
 */
16
package org.apache.ibatis.executor;
17

18
import java.sql.BatchUpdateException;
19
import java.util.List;
20

21
/**
22
 * This exception is thrown if a <code>java.sql.BatchUpdateException</code> is caught during the execution of any nested
23
 * batch. The exception contains the java.sql.BatchUpdateException that is the root cause, as well as the results from
24
 * any prior nested batch that executed successfully.
25
 *
26
 * @author Jeff Butler
27
 */
28
public class BatchExecutorException extends ExecutorException {
29

30
  private static final long serialVersionUID = 154049229650533990L;
31
  private final List<BatchResult> successfulBatchResults;
32
  private final BatchUpdateException batchUpdateException;
33
  private final BatchResult batchResult;
34

35
  public BatchExecutorException(String message, BatchUpdateException cause, List<BatchResult> successfulBatchResults,
36
      BatchResult batchResult) {
37
    super(message + " Cause: " + cause, cause);
×
38
    this.batchUpdateException = cause;
×
39
    this.successfulBatchResults = successfulBatchResults;
×
40
    this.batchResult = batchResult;
×
41
  }
×
42

43
  /**
44
   * Returns the BatchUpdateException that caused the nested executor to fail. That exception contains an array of row
45
   * counts that can be used to determine exactly which statement of the executor caused the failure (or failures).
46
   *
47
   * @return the root BatchUpdateException
48
   */
49
  public BatchUpdateException getBatchUpdateException() {
50
    return batchUpdateException;
×
51
  }
52

53
  /**
54
   * Returns a list of BatchResult objects. There will be one entry in the list for each successful sub-executor
55
   * executed before the failing executor.
56
   *
57
   * @return the previously successful executor results (maybe an empty list if no executor has executed successfully)
58
   */
59
  public List<BatchResult> getSuccessfulBatchResults() {
60
    return successfulBatchResults;
×
61
  }
62

63
  /**
64
   * Returns the SQL statement that caused the failure (not the parameterArray).
65
   *
66
   * @return the failing SQL string
67
   */
68
  public String getFailingSqlStatement() {
69
    return batchResult.getSql();
×
70
  }
71

72
  /**
73
   * Returns the statement id of the statement that caused the failure.
74
   *
75
   * @return the statement id
76
   */
77
  public String getFailingStatementId() {
78
    return batchResult.getMappedStatement().getId();
×
79
  }
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc