View Javadoc
1   /*
2    * Copyright 2004-2022 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 com.ibatis.sqlmap.engine.transaction;
17  
18  import java.sql.Connection;
19  import java.sql.SQLException;
20  
21  /**
22   * The Interface Transaction.
23   */
24  public interface Transaction {
25  
26    /**
27     * Commit.
28     *
29     * @throws SQLException
30     *           the SQL exception
31     * @throws TransactionException
32     *           the transaction exception
33     */
34    public void commit() throws SQLException, TransactionException;
35  
36    /**
37     * Rollback.
38     *
39     * @throws SQLException
40     *           the SQL exception
41     * @throws TransactionException
42     *           the transaction exception
43     */
44    public void rollback() throws SQLException, TransactionException;
45  
46    /**
47     * Close.
48     *
49     * @throws SQLException
50     *           the SQL exception
51     * @throws TransactionException
52     *           the transaction exception
53     */
54    public void close() throws SQLException, TransactionException;
55  
56    /**
57     * Gets the connection.
58     *
59     * @return the connection
60     *
61     * @throws SQLException
62     *           the SQL exception
63     * @throws TransactionException
64     *           the transaction exception
65     */
66    public Connection getConnection() throws SQLException, TransactionException;
67  
68  }