ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yusuf" <Yu...@ekalife.co.id>
Subject RE: Cache
Date Mon, 20 Feb 2006 05:01:06 GMT
Hi Larry,
fyi, i think the workaround is not working

tried this:
	sqlmap.queryForList("selectTest", "dummy");
combined with this
	<select id="selectTest" resultClass="map"

also tried this:
	sqlmap.queryForList("selectTest", "dummy");
combined with this
	<select id="selectTest" parameterClass="string"
resultClass="map" cacheModel="cache.references">

it still generate something like this in the log everytime i call it:

[DEBUG] [java.sql.Connection:42] - {conn-100009} Connection
[DEBUG] [java.sql.PreparedStatement:48] - {pstm-100010}
PreparedStatement:    select * from ... ...
[DEBUG] [java.sql.PreparedStatement:49] - {pstm-100010} Parameters: []
[DEBUG] [java.sql.PreparedStatement:50] - {pstm-100010} Types: []
[DEBUG] [java.sql.ResultSet:41] - {rset-100011} ResultSet
[DEBUG] [java.sql.ResultSet:61] - {rset-100011} Header: [a, b, c]
[DEBUG] [java.sql.ResultSet:65] - {rset-100011} Result: [a, b, c]

but i'm pretty sure some time ago (dont know the exact version, but an
older one) i successfully used the caching feature.. 


-----Original Message-----
From: Larry Meadors [mailto:lmeadors@apache.org]
Sent: Monday, February 20, 2006 11:07 AM
To: user-java@ibatis.apache.org
Subject: Re: Cache

Yeah...this is almost a bug, but not quite..the assumption is that if
you have no parameters that the query must change based on something
else, so it doesn't get cached. :-/

A workaround (I think..) is to call the query with a parameter object
that you ignore.

Object o = sqlmap.queryForList("ns.query", "ignoreMe");


On 2/19/06, Yusuf <Yusuf@ekalife.co.id> wrote:
> Hi,
> I was wondering about the cache feature in ibatis, i hope this isnt a
> stupid question:
>         <cacheModel id="cache.references" type="LRU" readOnly="true"
>                 serialize="false">
>                 <flushInterval hours="8" />
>                 <property name="cache-size" value="100" />
>         </cacheModel>
>         <select id="selectTest" resultClass="map"
> cacheModel="cache.references">
>                 select * from dual
>         </select>
> I have a cache setting like above, but if i use log4j to log the
> it seems that it always query again to database.. is there something
> wrong with my config?
> Thanks,
> Yusuf S.

View raw message