I started by calling a mapper method onto my select query, which worked
fine. Then added a call to that same select query using a custom
result-mapper, to do filtering, but the result-mapper did not get
called. If I don't call the mapper method first then my result-mapper
is called in the second statement below:
mapper.selectPersonList()
session.select("...selectPersonList", null, new
PersonResultMapper())
The first call you make to a session for a given query will cache the
result-mapper (a default in the case above) and then ignore any
subsequent calls parameters. If I close and re-open a new session
between the above they both work.
hope this helps...
On 07/01/2010 18:36, Clinton Begin wrote:
I'm not sure I understand. Can you provide a few lines of code to demonstrate?
On 2010-01-07, Roy Bailey<roy.bai...@odinium.com> wrote:
Hi, I've been using Ibatis2 for the last couple of years - great job,
and thanks.
I'm now trying out Ibatis3 and have seen the following behavior:
When I call a selectList query with a ResultMapper it works, but when I
call it with an SQLSession that has already called this query without a
ResultMapper it doesn't. It looks like the sql-session is caching the
default result-mapper on the first call and then ignoring the passed
result-mapper on the second call.
I can work around this by using different sql-sessions, but thought you
might like to know as it had me confused for a time. If this is correct
behavior then it might be as well to throw an exception when the second
call with a ResultMapper is executed to tell the user this sql-session
already has a mapper. Alternatively, on the calls with a passed
result-mapper, you may be able to keep the original result-mapper in a
local variable, overwrite this default with the passed value, perform
the query, then restore the original result-mapper. That way multiple
calls with/without result-mappers would continue to work as expected
from a single sql-session?
regards...
Roy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org