Use t his instead: <select id="searchAssets" parameterClass="com.mafoi.assetregister.core.Search" resultClass="java.util.HashMap" remapResults="true">
My guess is that your tests are reloading the sql map each tim, so the results are being mapped each time. In your app, that is not the case. Adding remapResults="true" will make it so. Be aware that this could cause a noticable performance degradation. If this query needs to run fast, find a way to make it return the same results (into a bean) every time you run it. Larry On 7/12/05, Vamsee Kanakala <[EMAIL PROTECTED]> wrote: > Hi list, > > I'm facing a strange problem. I have a pretty big query using a > lot of dynamic sql satements, like this: > > http://rafb.net/paste/results/Glxoo380.html > > This query basically selects a bunch of columns based on the parameters > passed. When I run this statement in isolation from a test, it works > flawlessly. I start up tomcat, and run it from the search page, it works > once or twice, and the next time it gives a nasty exception like this: > > org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation: > encountered SQLException [ > --- The error occurred in com/mafoi/assetregister/dao/Search.xml. > --- The error occurred while applying a result map. > --- Check the searchAssets-AutoResultMap. > --- Check the result mapping for the 'netbalance04' property. > --- Cause: org.postgresql.util.PSQLException: The column name netbalance04 > not found.]; nested exception is > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in com/mafoi/assetregister/dao/Search.xml. > --- The error occurred while applying a result map. > --- Check the searchAssets-AutoResultMap. > --- Check the result mapping for the 'netbalance04' property. > --- Cause: org.postgresql.util.PSQLException: The column name netbalance04 > not found. > > I know the error is self-explanatory, but the 'netbalance04' should not > even be selected in this query! Weird thing is that, it works when I run > the queries independently from a testcase. So I'm guessing that the > result map, which is a HashMap, is getting cached somewhere and ibatis > is trying to get the previous query's column names from the current > result set? It's just guess work, but I'm truly lost. Please help. > > Regards, > Vamsee. >
