So, for some reason my Google Fu was weak this morning when I wasted a half an hour looking for the solution so clearly laid out
here. If you're dynamically setting $tables$ in your sqlmap to a dynamic resultclass, Ibatis remembers the mapping of the previous query results to save time. This'll throw an error like
Exception in thread "main" com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in SqlMaps.xml.
--- The error occurred while applying a result map.
--- Check the getSpecs-AutoResultMap.
--- Check the result mapping for the 'MAX_APERTURE' property.
--- Cause: java.sql.SQLException: Invalid column name
Caused by: java.sql.SQLException: Invalid column name
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(Unknown Source)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(Unknown Source)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(Unknown Source)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(Unknown Source)
Solution is a super simple boolean in the select element "remapResults". Making it look something like:
select id="getSpecs" parameterClass="java.util.HashMap" resultClass="java.util.HashMap" remapResults="true"
0 comments:
Post a Comment