Hi, at last i found the problem...
I'm missing this config:
<settings
cacheModelsEnabled="true"
/>
but i'm pretty sure the docs said that cacheModels are enabled by
default.
Anyway.. thanks for the feedback,
Yusuf
-----Original Message-----
From: Yusuf
Sent: Monday, February 20, 2006 12:01 PM
To: [email protected]
Subject: RE: Cache
Hi Larry,
fyi, i think the workaround is not working
tried this:
sqlmap.queryForList("selectTest", "dummy");
combined with this
<select id="selectTest" resultClass="map"
cacheModel="cache.references">
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..
Thanks,
Yusuf.
-----Original Message-----
From: Larry Meadors [mailto:[EMAIL PROTECTED]
Sent: Monday, February 20, 2006 11:07 AM
To: [email protected]
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");
Larry
On 2/19/06, Yusuf <[EMAIL PROTECTED]> 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
query,
> it seems that it always query again to database.. is there something
> wrong with my config?
>
> Thanks,
> Yusuf S.
>
>