ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave.De...@Equifax.com
Subject Problem executing dynamic SQL statement
Date Fri, 26 Oct 2007 13:25:28 GMT

I'm having a problem with a dynamic statement. It is executed against
different tables that have different structures. But it seems that the
columns for the first execution are being cached somehow. The statement is

<select id="getScoreCounts" parameterClass="map" resultClass=
      select      * from
      <iterate open="(" close=")" conjunction="),(" property="scoreCodes">
            select count($scoreCodes[]$) as $scoreCodes[]$
            from $tableName$
            where $scoreCodes[]$ is not null and record_type = #recordType#

The result is the same without the <dynamic> tag. The logged statement
looks correct, but the SQL error references a column from a previous

For example, in the logs I'll see something like

select * from      (    select count(COL_A) as COL_A from TABLE_X where
COL_A is not null and record_type = ?   ),(    select count(COL_B) as COL_B
from TABLE_A where COL_B is not null and record_type = ?   )

this statemnet will succeed. then I'll see something like

select * from      (    select count(COL_A) as COL_A from TABLE_YY where
COL_A is not null and record_type = ?   )

and that will cause a SQL error:

check the result mapping for the 'COL_B' property.
Cause: java.sql.SQLException: Invalid column name

Since there is no 'COL_B' in that statement, this is causing me a lot of
grief; I would sure appreciate some insight on this.

BTW I'm using version, with Spring 2.0.4

Dave Derry

We must begin not just to act, but to think, for there is no better slave
than the one who believes his slavery to be freedom, and we are in
no greater peril than when we cannot see the chains on our minds
because there are yet no chains on our feet.
-- Michael Reid

This message contains information from Equifax Inc. which may be
confidential and privileged.  If you are not an intended recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited.  If you have
received this transmission in error, please notify by e-mail

View raw message