ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From starfish0r <starfis...@gmail.com>
Subject Serious Problem with Select resultClass=HashMap on different tables
Date Thu, 07 Jan 2010 11:18:37 GMT

Hey everyone,
I've been working with iBatis for a year now and so far it's been
I am working with many different tables and created a web app to dynamically
view data from any table.
Of course in this case i cannot work with a table-specific class as a
resultClass due to different table columns/column names.

The solution was to use one select statement with resultClass=HashMap.
Unfortunately, iBatis internally remembers which columns a query returns.
(Found out about that by stepping through iBatis' sources at runtime)
When i switch to viewing another table, the select fails, because the
statement does not retrieve values for the 'remembered' columns.

<select id="dynamicSelect" parameterClass="java.util.HashMap"
    SELECT * FROM $table$ WHERE $prefix$_used_flag = 1

As u can see, i provide which table to get the data from.
I select data from the first table, which contains the column 'ptt_id'.
When i call the same query on a different table, the query fails:

--- The error occurred in maps/mapFormTable.xml.
--- The error occurred while applying a result map.
--- Check the FormTable.dynamicSelect-AutoResultMap.
--- Check the result mapping for the 'ptt_id' property.
--- Cause: java.sql.SQLException: Column 'ptt_id' not found.

How do i fix this? The application heavily relies on that functionality.
The 'remembering' map is not accessible, so i cannot modify iBatis'
expectations regarding the result HashMap.

I have tried capsulating the queries in their own transaction, session and
Nothing works...

Help would be highly appreciated!
View this message in context: http://old.nabble.com/Serious-Problem-with-Select-resultClass%3DHashMap-on-different-tables-tp27058010p27058010.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org

View raw message