No, the use of $'s is required because it is begin used to specify columns and tables in the SELECT-clause. #'s would pass the columns as a parameter for the prepared statements, this would cause an SQLException.
This is definitely related to the iterate-tag, I believe some rework is done to this part of iBATIS by Jeff Butler, do not know the details about this.
Niels
From: Olaf Bey [mailto: [EMAIL PROTECTED]]
Sent: maandag 8 mei 2006 16:01
To: user-java@ibatis.apache.org
Subject: Re: nested iterate over 2 different properties
Hello Guido,
shouldn't it be #agrupaciones[]# instead of $agrupaciones[]# ?
Greetings,
OlafOn 5/8/06, Guido García Bernardo < [EMAIL PROTECTED]> wrote:
Hello,
I am using ibatis 2.1.7, and I have the following sql statement:
<statement ...>
<iterate property="tabla" conjunction="UNION">
SELECT
<iterate property="agrupaciones" conjunction=",">
TABLA.$agrupaciones[]$
</iterate>
FROM $tabla[]$ TABLA
WHERE
TABLA.A IN ('A','B','C','D','W','G')
</iterate>
</statement>
where:
$tabla[]$ = { "PENDIENTES", "ANULADAS" }
$agrupaciones[]$ = { "AREA" }
but the generated sentence is:
SELECT
TABLA.AREA
FROM PENDIENTES TABLA
WHERE
TABLA.A IN ('A','B','C','D','W','G')
UNION
SELECT
FROM ANULADAS TABLA WHERE
TABLA.A IN ('A','B','C','D','W','G')
instead of:
SELECT
TABLA.AREA
FROM PENDIENTES TABLA
WHERE
TABLA.A IN ('A','B','C','D','W','G')
UNION
SELECT
TABLA.AREA
FROM ANULADAS TABLA
WHERE
TABLA.A IN ('A','B','C','D','W','G')
It seems not to be using the correct index for the property "agrupaciones" in the second iteration of the property "tabla"... I think this is a bug (maybe related to http://issues.apache.org/jira/browse/IBATIS-281)
Is there any idea or workaround to solve it?
Thank you very much,
Guido García Bernardo
I don't think the iterate tag has any notion of restarting the iteration. So I think this is another example of the brokenness of the dynamic tags. I am looking at this, but it is quite complex and there are many issues. So there's not a quick fix.
Right now I'm collecting test cases of brokenness in the dynamic tags so that I can test many different aspects of these tags - I will add your example to my list.
Jeff Butler
On 5/8/06, Niels Beekman <[EMAIL PROTECTED]> wrote:
- Re: nested iterate over 2 different properties Jeff Butler
- Re: nested iterate over 2 different properties Jeff Butler