ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Hall" <JH...@cihi.ca>
Subject RE: Implicit Mapping and Dynamic SQL
Date Tue, 03 May 2005 18:29:36 GMT
I figured it out
remapResults="true"
 
I test it and it works!!!
 
Thanks Larry.
 
JH.

-----Original Message-----
From: Jason Hall [mailto:JHall@cihi.ca]
Sent: Tuesday, May 03, 2005 1:29 PM
To: ibatis-user-java@incubator.apache.org; lmeadors@apache.org
Subject: RE: Implicit Mapping and Dynamic SQL


how do you use this parameter
<statement id="selectTable" remapResults=??>
 
select * from $table$
</statement>
 
also does it only work for 2.1.0?
 
I'm using 2.0.8.

-----Original Message-----
From: Larry Meadors [mailto:larry.meadors@gmail.com]
Sent: Tuesday, May 03, 2005 7:48 AM
To: ibatis-user-java@incubator.apache.org
Subject: Re: Implicit Mapping and Dynamic SQL



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



On 5/3/05, Jason Hall < JHall@cihi.ca> wrote: 


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)




Mime
View raw message