View Javadoc
1   /*
2    * SPDX-License-Identifier: Apache-2.0
3    * See LICENSE file for details.
4    *
5    * Copyright 2015-2026 the original author or authors.
6    */
7   package org.springframework.orm.ibatis;
8   
9   import com.ibatis.sqlmap.client.SqlMapExecutor;
10  
11  import java.sql.SQLException;
12  
13  /**
14   * Callback interface for data access code that works with the iBATIS {@link com.ibatis.sqlmap.client.SqlMapExecutor}
15   * interface. To be used with {@link SqlMapClientTemplate}'s {@code execute} method, assumably often as anonymous
16   * classes within a method implementation.
17   *
18   * @author Juergen Hoeller
19   *
20   * @since 24.02.2004
21   *
22   * @see SqlMapClientTemplate
23   * @see org.springframework.jdbc.datasource.DataSourceTransactionManager
24   *
25   * @deprecated as of Spring 3.2, in favor of the native Spring support in the Mybatis follow-up project
26   *             (https://mybatis.org/)
27   */
28  @Deprecated
29  public interface SqlMapClientCallback<T> {
30  
31    /**
32     * Gets called by {@code SqlMapClientTemplate.execute} with an active {@code SqlMapExecutor}. Does not need to care
33     * about activating or closing the {@code SqlMapExecutor}, or handling transactions.
34     * <p>
35     * If called without a thread-bound JDBC transaction (initiated by DataSourceTransactionManager), the code will simply
36     * get executed on the underlying JDBC connection with its transactional semantics. If using a JTA-aware DataSource,
37     * the JDBC connection and thus the callback code will be transactional if a JTA transaction is active.
38     * <p>
39     * Allows for returning a result object created within the callback, i.e. a domain object or a collection of domain
40     * objects. A thrown custom RuntimeException is treated as an application exception: It gets propagated to the caller
41     * of the template.
42     *
43     * @param executor
44     *          an active iBATIS SqlMapSession, passed-in as SqlMapExecutor interface here to avoid manual lifecycle
45     *          handling
46     *
47     * @return a result object, or {@code null} if none
48     *
49     * @throws SQLException
50     *           if thrown by the iBATIS SQL Maps API
51     *
52     * @see SqlMapClientTemplate#execute
53     * @see SqlMapClientTemplate#executeWithListResult
54     * @see SqlMapClientTemplate#executeWithMapResult
55     */
56    T doInSqlMapClient(SqlMapExecutor executor) throws SQLException;
57  
58  }