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: Request for examples of remapResults
Date Thu, 26 Jan 2006 20:56:32 GMT
Here's a quick answer...

You should use remapResults when a query has a variable set of return
columns.  For example, if I say:

    select $fieldList$
    from table


    select *
    from $someTable$

Since the overhead to introspect the result set metadata is not trivial,
iBATIS will remember what was returned the last time the query was run.
This could create problems in these situations.

Without remapResults: If I set fieldList = 'fld1, fld2' the first time,
iBATIS will think that fld1 and fld2 are in the result set for the query
every time I run it.  So if the next time I run the query I specify
fieldList='fld3, fld4', iBATIS will not find fld1 and fld2 in the result
set, and will not return the proper results.  And iBATIS won't know about
fld3 and fld4 because they weren't in the query the first time it was run.

With remapResults: iBATIS will introspect the result set metadata every time
the query is run and will always return the proper results.

This feature comes at some performance cost, so only use it if you really
need it - when there is a variable set of returned columns (or if there is a
variable table name, etc.)

Jeff Butler

On 1/26/06, Ted Schrader <TSchrader@sgi-net.com> wrote:
>  Hello,
> I've Googled "remapResults" to get an idea of what this attribute does.
> The search results have been a bit sparse and I don't think I understand it
> completely.
> Would anyone be so kind as to provide some examples of when I should use
> it and why?  Better yet, perhaps this would be an excellent addition to the
> FAQ section of the SqlMaps wiki.
> Thanks!
> Ted

View raw message