ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zarar.sidd...@utoronto.ca
Subject Re: Problems with displaying contents of table
Date Sat, 07 Jan 2006 19:59:16 GMT

The first time you called "select", IBatis determined a way to process all
calls to the statement.  So the next time you call it, IBatis is trying to
process the query the same way it did earlier (which is understandable).
But alas, the table has changed and whatever IBatis has stored in memory
is no longer applicable.  

One solution might be to re-initialize the SqlMapClient again the same way
you did on application startup.  This should fix the problem but you will
lose any caching that you might be doing or IBatis might have done. 

IBatis' behavior is correct as it can't afford to analyze maps on
every single call and does the work once.  Altering a table is a fairly
large move, are you sure you can't avoid it?

Zarar Siddiqi



On Sat, 7 Jan 2006, Aladin wrote:

> Hello,
> 
> I've just run into a problem and cannot find a solution - please read an 
> ask for explanation if anything is not clear:
> 
> SETUP:
> ======
> * I have a table XXX with columns a & b
> * I have a query which displays the contents of XXX
> * I have a query which alters (ADD or DROP) the columns of XXX
> * Each query is in an sql-map (under different keys)
> * In sql-map-config all caching is turned off
> Queries:
> <update id="alterTable">ALTER TABLE $tableName$ $columns$</update>
> <select id="select" resultClass="app.SearchResultObject">SELECT * FROM 
> $tableName$</select>
> 
> PROBLEM:
> ========
> 1) User calls the query which displays XXX successfully on the screen
> 2) User calls the query which DROPs column b from table XXX
> 3) User calls the query which displays XXX on the screen and ERROR occurs:
> 
> javax.servlet.ServletException: 
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in /db/sql/surveys.xml.
> --- The error occurred while applying a result map.
> --- Check the getSurveyResults-AutoResultMap.
> --- Check the result mapping for the 'b' property.
> --- Cause: java.sql.SQLException: Column 'b' not found.
> Caused by: java.sql.SQLException: Column 'b' not found.
> 
> Thanks
> Aladin
> 


Mime
View raw message