I need a solution to undo a long select statement. I am using Spring 3.0.2, iBatis 2.3.0 and Oracle 10g. I managed to get it to work with simple JDBC, but since the selection is generated dynamically through the advanced search screen, I really need to use iBatis.
The iBatis inner class, responsible for creating / retrieving prepared statements from the cache, com.ibatis.sqlmap.engine.execution.SqlExecutor . The internal method invoked for each call to queryForList () / queryForObject () is SqlExecutor's
public void executeQuery(RequestScope request, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException
Method.
Due to performance reasons, iBatis only creates a new prepared statement if it does not already exist for this select statement. Ready statements are stored / cached in HashMap, where the sql string is the key and the prepared statement is the value.
After you tried other solutions without success, I think that you could work with AOP ( AspectJ ) to try to point to the SqlExecutor.executeQuery () method and somehow save the iBatis cache map and sql string in an HTTP session.
When a user tries to cancel a lengthy request, the check will be done from another thread to see if there is already a prepared statement in the iBatis cache map for this sql string previously stored in the HTTP session through AOP. If it exists, a Statement.cancel () request is issued. I don’t understand why such a solution can interfere with the internal mechanisms of iBatis, because if the ready statement is canceled, a SqlException will be thrown ( user ORA-01013 requested to cancel the current operation ) and Ibatis will correctly handle this like any other SqlException thrown.
Spring AOP , , , Spring. SqlExecutor Spring bean, iBatis.
AspectJ, AspectJ.
, , , iBatis, iBatis, , ( myBatis).