ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shannon, Bryan" <BShan...@Tribune.com>
Subject RE: Ibatis caching Empty ResultSet
Date Thu, 10 Jul 2008 22:34:37 GMT
Can someone please confirm whether or not iBatis used to cache the empty
resultset in previous versions?

We have a similar situation to Serge, in his slightly older thread, in
which our code relied on iBatis not returning the null result for the
second SELECT. (ie NOT caching an empty result)

Upon upgrading from 2.0.9B to the latest version of iBatis, we
discovered that our code which used to assume that the db query would be
re-run the second time (after the insert, similar to Serge) and find the
newly inserted value...

I understand that it DOES make sense to cache the empty results, but did
this logic change?  (I'm fully prepared to look at the code diffs
myself, but if someone could give me a head start, it'd be great!)

If it is the case that we have to flush the cache with the INSERT of
each new value, then it seems in these situations we'd only have about
item in our cache, rendering it less useful. 

Any help would be greatly appreciated! ;-)

-----Original Message-----
From: Serge Sozonoff [mailto:serge@sozonoff.com] 
Sent: Sunday, February 10, 2008 3:25 AM
To: user-java@ibatis.apache.org
Subject: Re: Ibatis caching Empty ResultSet

Hi Nathan and Jeff,

> The real question is why are you not clearing the cache on the insert 
> statement?
I don't see why I would clear the cache for an insert statement. As far
as I am concerned an inserted record shouldn't already be in the cache
before its been inserted.

> caches are generally agnostic about the content of the cache.
Agreed, the cache can be agnostic about its content but then the real
question is why is iBatis inserting an empty result set into the cache
in the first place.
> This would solve your issue and ensure that your cache is always in a 
> "clean" state.  I know you claim that this "makes no sense" but it 
> does :) As long as you are issues more then one select between inserts

> which is normally the case.
Yes I know that will fix the problem but its totally stupid to flush the
entire cache upon insert of a new record.


View raw message