ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roy Bailey <roy.bai...@odinium.com>
Subject Ibatis3 - select with ResultMapper behavior
Date Thu, 07 Jan 2010 15:12:08 GMT
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?


To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org

View raw message