ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Accountius <ric...@us.ibm.com>
Subject Help with HashMap
Date Mon, 02 Jul 2007 21:27:31 GMT

I'm kind of new to Ibatis, so if I'm missing the obvious, let me apologize 

right up front. 

Nonetheless, here is my problem.  I am using a HashMap as the resultClass 
to retrieve results from a DB2 database.  My problem is the column order 
(not row order) returned appears to be almost random.  How do I "force" 
Ibatis to return the columns in the same order as they appear (returned) 
in the SQL query? 

For example, here is my query:

SELECT A as COL_A, B as COL_B, C as COL_C from tablexxxx

My results can be COL_B, COL_A, COL_C..........or COL_C, COL_B, 
COL_A..........or , etc, etc.

I have logged java.sql and the columns are being returned in the proper 
order, but eventually they get "realigned".  Can someone explain to me 
why?  I'd really appreciate it.  I know I can use a ResultMap to have the 
columns listed in the proper order, but what I'm trying to do is use the 
same Ibatis select statement to "service" arbitrary SQL statements.  Hope 
I'm making sense.

<select id="getReport" parameterClass="com.ibm.bean.ReportDefinition" 
resultClass="java.util.HashMap" remapResults="true">



Rick Accountius 
Internet: rickac@us.ibm.com
View raw message