ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Urbaneja" <urbanej...@gmail.com>
Subject Re: Unable to make cache work
Date Sat, 19 Aug 2006 16:07:53 GMT
Thank you for your quick response.

Do you mean the cacheModelsEnabled attribute of the settings element?
I read in the docs that the default is true, so I did not include it.
This is my main config:

<sqlMapConfig>

  <properties resource="properties/database.properties"/>

  <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property value="${driver}" name="JDBC.Driver"/>
      <property value="${url}" name="JDBC.ConnectionURL"/>
      <property value="${username}" name="JDBC.Username"/>
      <property value="${password}" name="JDBC.Password"/>
    </dataSource>
  </transactionManager>

  <sqlMap resource="es/como/jtp/persistence/sqlmapdao/sql/User.xml"/>
  <sqlMap resource="es/como/jtp/persistence/sqlmapdao/sql/Country.xml"/>
  <!--
  <sqlMap resource="es/como/jtp/persistence/sqlmapdao/sql/Sequence.xml"/>
  -->

</sqlMapConfig>

On 8/19/06, Niels Beekman <n.beekman@wis.nl> wrote:
>
>  Did you enable global caching in the main config?
>
>
>
> Niels
>
>
>  ------------------------------
>
> *From:* Javier Urbaneja [mailto:urbanejarl@gmail.com]
> *Sent:* zaterdag 19 augustus 2006 17:16
> *To:* user-java
> *Subject:* Unable to make cache work
>
>
>
> I'm using SqlMaps 2.2.0 with DAO.
>
> Configuration of the cached stament:
>
>   <cacheModel id="all-countries-cache" type="MEMORY" readOnly="true">
>     <flushInterval hours="24"/>
>     <property name="reference-type" value="STRONG"/>
>   </cacheModel>
>
>   <resultMap class="country" id="countryResult">
>     <result property="idCountry" column="ID_COUNTRY" jdbcType="INTEGER"
> javaType="int"/>
>     <result property="name" column="COUNTRY" jdbcType="VARCHAR"
> javaType="string"/>
>   </resultMap>
>
>   <select id="getAllCountries" resultMap="countryResult"
> cacheModel="all-countries-cache">
>     select * from countries
>   </select>
>
> Log configuration:
>
> log4j.rootLogger=DEBUG, stdout
> log4j.logger.com.ibatis.sqlmap.engine.cache.CacheModel=DEBUG
> log4j.logger.java.sql.Statement=DEBUG
> log4j.logger.java.sql.PreparedStatement=DEBUG
> log4j.logger.java.sql.ResultSet=DEBUG
>
> Relevant log entries:
>
> DEBUG [http-8080-2] - Created connection 31633330.
> DEBUG [http-8080-2] - {conn-100000} Connection
> DEBUG [http-8080-2] - {conn-100000} Preparing Statement:      select *
> from countries
> DEBUG [http-8080-2] - {pstm-100001} Executing Statement:      select *
> from countries
> DEBUG [http-8080-2] - {pstm-100001} Parameters: []
> DEBUG [http-8080-2] - {pstm-100001} Types: []
> DEBUG [http-8080-2] - {rset-100002} ResultSet
> DEBUG [http-8080-2] - {rset-100002} Header: [ID_COUNTRY, COUNTRY]
> DEBUG [http-8080-2] - {rset-100002} Result: [0, No especificado]
> DEBUG [http-8080-2] - {rset-100002} Result: [1, España]
> DEBUG [http-8080-2] - {rset-100002} Result: [2, China]
> DEBUG [http-8080-2] - Returned connection 31633330 to pool.
> DEBUG [http-8080-2] - Checked out connection 31633330 from pool.
> [...Another application execution log entries...]
> DEBUG [http-8080-1] - Checked out connection 31633330 from pool.
> DEBUG [http-8080-1] - {conn-100008} Connection
> DEBUG [http-8080-1] - {conn-100008} Preparing Statement:      select *
> from countries
> DEBUG [http-8080-1] - {pstm-100009} Executing Statement:      select *
> from countries
> DEBUG [http-8080-1] - {pstm-100009} Parameters: []
> DEBUG [http-8080-1] - {pstm-100009} Types: []
> DEBUG [http-8080-1] - {rset-100010} ResultSet
> DEBUG [http-8080-1] - {rset-100010} Header: [ID_COUNTRY, COUNTRY]
> DEBUG [http-8080-1] - {rset-100010} Result: [0, No especificado]
> DEBUG [http-8080-1] - {rset-100010} Result: [1, España]
> DEBUG [http-8080-1] - {rset-100010} Result: [2, China]
> DEBUG [http-8080-1] - Returned connection 31633330 to pool.
>
>
> I've tried LRU cache type also, without success.
> It's a web application with the same arquitecture as the JPetStore 5
> (DaoConfig, XxxDao, XxxSqlMapDao, Xxx[domain objects], XxxService,
> XxxBean[presentation Struts beanaction beans]).
> The getAllCountries query will be repeated in each user registration or
> modification, and the list of countries its unlikely to change, so it's a
> natural candidate for caching.
>
> Thank you very much.
>

Mime
View raw message