The remapResults attribute is used if you have a need to dynamically change the result map when the statement is called. While this makes the returned data more flexible, the cost is pretty high, so use it with caution.
Larry
Hi,
I use the following sqlMap statement.
<statement id="selectTable" resultClass="java.util.HashMap">
select * from $table$
</statement>
In my java code this works
List l = queryForList("selectTable","TABLE_A");
but when i do this with same statement id (selectTable) ...
List l = queryForList("selectTable","TABLE_A");
List l2 = queryForList("selectTable","TABLE_B");
The first queryForList works but the second doesn't.
In the error it complains that columns that are in TABLE_A are not in
TABLE_B. Well this is obvious. What's happening the columns are not being flushed
"somewhat - i think??" before the next queryForList is executed.
See. I do the following it works with the same table "TABLE_A"...
List l = queryForList("selectTable","TABLE_A");
List l2 = queryForList("selectTable","TABLE_A");
This is the error I got when the second queryForList has been executed (has been modified for
privacy)
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in Table.xml.
--- The error occurred while applying a result map.
--- Check the LookupMap.selectLookupTable-AutoResultMap.
--- Check the result mapping for the 'COLUMN_TABLE_A' property.
--- Cause: java.sql.SQLException: Column not found
Caused by: java.sql.SQLException: Column not found
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatem
ent.java:180)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.j
ava:118)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:626)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:598)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:107)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:76)
Caused by:
java.sql.SQLException: Column not found
at sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1790)
at sun.jdbc.odbc.JdbcOdbcResultSet.getObject(JdbcOdbcResultSet.java:1683)
at com.ibatis.sqlmap.engine.type.ObjectTypeHandler.getResult(ObjectTypeHandler.java:35)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResultMappingValue(BasicResultM
ap.java:383)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:207)
at com.ibatis.sqlmap.engine.mapping.result.AutoResultMap.getResults(AutoResultMap.java:52)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:349)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:179)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:
200)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatem
ent.java:168)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.j
ava:118)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:626)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:598)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:107)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:76)