ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From François Schiettecatte <fschietteca...@gmail.com>
Subject Migrating from ibatis 2 to 3
Date Thu, 04 Mar 2010 11:55:48 GMT

I have been migrating a project from ibatis 2 to 3 and have run into some issues, mostly to
do with connection pool management (C3P0), and I will write up my notes on my blog once I
am done.

Two issues specifically with the Session Level Cache:

Clearing the Session Level Cache

	void clearCache()

The SqlSession instance has a local cache that is cleared upon update, commit, rollback and
close. To close it explicitly (perhaps with the intention to do more work), you can call clearCache().

One issue is that it seems to cache selects which does not work if the data has been changed
by another process, running the select again in the same session returns stale data.

The other problem has to do with sharing sql sessions across threads (which worked fine in
2). Running multiple selects through the same session gives me casting errors generated by
line 88 in BaseExecutor:

       localCache.putObject(key, EXECUTION_PLACEHOLDER);

What seems to be happening is that the same query is coming in on one thread and generates
a hit on the localCache before the search is done on another thread.

Note that I am using C3P0 here which recommends caching sessions as much as possible and it
could be that I am not using the stack correctly, but what I was doing worked fine in 2.x
under heavy load.



François Schiettecatte
35 Washington Square North, #2
Salem, MA, 01970

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

View raw message