ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Butler <jeffgbut...@gmail.com>
Subject Re: position while iterating
Date Wed, 11 Feb 2009 22:24:19 GMT
There is not a way to determine the position in the list.

I would add the alias as an attribute somewhere in the parameter
object and calculate it in Java ($attributes[].alias).

Jeff Butler


On Wed, Feb 11, 2009 at 1:33 PM, Chris O'Connell
<oconnell@gorillachicago.com> wrote:
> Is there any way to find my position while iterating through a collection in
> the sqlMap file.  For example, I want to do something like this:
>
> <iterate property="attributes" >
>
>                ,(
>
>                    SELECT TEMP_PA.PRODUCT_ID
>                    FROM PRODUCT_ATTRIBUTES TEMP_PA,
>                        ATTRIBUTES TEMP_A
>                    WHERE (
>                        TEMP_A.ATTRIBUTE_ID = TEMP_PA.ATTRIBUTE_ID
>                        AND TEMP_A.NAME = #attributes[].name#
>                        <iterate property="attributes[].values" prepend="
> AND ( " close=" ) " conjunction=" OR " >
>                            <isNotEmpty
> property="attributes[].values[].value">
>
>                                    TEMP_PA.VALUE =
> #attributes[].values[].value#
>
>                            </isNotEmpty>
>                        </iterate>
>                    )
>                ) TEMP$attributes[].name$_{POSITION_IN_ITERATION}
>                </iterate>
>
> I may have multiple attributes with the same name, so I need something that
> will allow me to uniquely name this alias.  Anyone have any ideas?
>
> Thanks,
> Chris
>
>
>

Mime
View raw message