You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Claudio Martins (JIRA)" <ib...@incubator.apache.org> on 2005/03/03 02:32:48 UTC

[jira] Commented: (IBATIS-82) Cache Model LRU not working

     [ http://issues.apache.org/jira/browse/IBATIS-82?page=comments#action_60083 ]
     
Claudio Martins commented on IBATIS-82:
---------------------------------------

I think I found the problem. After I call the QueryForList method, I put all returned beans on an array. After that, I call the .clear() method from the List object and set it to null afterwards.



> Cache Model LRU not working
> ---------------------------
>
>          Key: IBATIS-82
>          URL: http://issues.apache.org/jira/browse/IBATIS-82
>      Project: iBatis for Java
>         Type: Bug
>     Versions: 2.0.9
>     Reporter: Claudio Martins

>
> I use the LRU cache model for caching of my database objects.
> On the first query, things work ok, but the other ones, just returns null.
> I tried many, many things to make it work, unsuccessfully.
> When I disabled caching, everything worked fine.
> Here are my configuration files:
> Main Configuration File
> -----------------------
> <settings
>     cacheModelsEnabled="true"
>     enhancementEnabled="true"
>     lazyLoadingEnabled="true"
>     maxRequests="32"
>     maxSessions="10"
>     maxTransactions="5"
>     useStatementNamespaces="false"
>    />
>    <transactionManager type="JDBC">
>       <dataSource type="SIMPLE">
>          <property name="JDBC.Driver" value="${driver}"/>
>          <property name="JDBC.ConnectionURL" value="${url}"/>
>          <property name="JDBC.Username" value="${username}"/>
>          <property name="JDBC.Password" value="${password}"/>
>          <property name="JDBC.DefaultAutoCommit" value="true"/>
>          <property name="Pool.MaximumActiveConnections" value="10"/>
>          <property name="Pool.MaximumIdleConnections" value="5"/>
>          <property name="Pool.TimeToWait" value="500"/>
>          <property name="Pool.PingQuery" value="SELECT SYSDATE FROM DUAL"/>
>          <property name="Pool.PingEnabled" value="false"/>
>          <property name="Pool.PingConnectionsOlderThan" value="1"/>
>          <property name="Pool.PingConnectionsNotUsedFor" value="1"/>
>       </dataSource>
>    </transactionManager>
>    
>    .... (other stuff from here)
> SqlMap File
> ------------
>    <cacheModel id="cache-Cobranca" type="LRU">
>       <flushInterval hours="2"/>
>       <property name="size" value="1000"/>
>    </cacheModel>
>    <statement id="select-valor-nao-pago" 
>               parameterClass="com.globo.billing.core.beans.PesquisaValoresNaoPagosBean" 
>               resultClass="com.globo.billing.core.beans.PesquisaValoresNaoPagosBean" 
>               cacheModel="cache-Cobranca">
>         SELECT
>            COB.COBRANCA_ID as codigoCobranca,
>            COB.ASSINATURA_ID as codigoAssinatura,
>            COB.VALOR_LIQUIDO_NUM as valorLiquido,
>            DATA_VENC as dataVencimento,
>            VALOR_PAGO_NUM as valorPago,
>            DATA_PGTO as dataPagamento,
>            DATA_CANCELAMENTO as dataCancelamento,
>            AGENTE_EMISSOR_ID as agenteEmissor,
>            STATUS_NUM as statusCobranca,
>            TIPO_COBRANCA_ID as tipoCobranca,
>            LINHA_COBRANCA_ID as codigoLinhaCobranca,
>            VALOR_UNITARIO_NUM as valorUnitario,
>            TIPO_LINHA_ID as tipoLinhaCobranca,
>            MES_COMPETENCIA_DT as mesReferencia
>          FROM
>            TB_GLB_SGP_BOLETO_AVULSO   BA,
>            (SELECT
>               COBRANCA.COBRANCA_ID,
>               COBRANCA.ASSINATURA_ID,
>               COBRANCA.VALOR_LIQUIDO_NUM,
>               COBRANCA.DATA_VENC,
>               COBRANCA.VALOR_PAGO_NUM,
>               COBRANCA.DATA_PGTO,
>               COBRANCA.DATA_CANCELAMENTO,
>               COBRANCA.AGENTE_EMISSOR_ID,
>               COBRANCA.STATUS_NUM,
>               COBRANCA.TIPO_COBRANCA_ID,
>               LINHA.LINHA_COBRANCA_ID,
>               LINHA.VALOR_UNITARIO_NUM,
>               LINHA.TIPO_LINHA_ID,
>               COBRANCA.MES_COMPETENCIA_DT
>              FROM
>               TB_GLB_SGP_COBRANCA        COBRANCA,
>               TB_GLB_SGP_LINHA_COBRANCA  LINHA
>              WHERE
>                   COBRANCA.ASSINATURA_ID = #codigoAssinatura:NUMERIC#
>               AND COBRANCA.COBRANCA_ID = LINHA.COBRANCA_ID
>               AND COBRANCA.COBRANCA_ID = (SELECT
>                                              MAX(COBRANCA_ID)
>                                            FROM
>                                              TB_GLB_SGP_COBRANCA COBRANCA2
>                                            WHERE
>                                              COBRANCA2.ASSINATURA_ID = COBRANCA.ASSINATURA_ID) ) cob
>          WHERE
>               COB.COBRANCA_ID = BA.COBRANCA_ID(+)
>           AND (STATUS_NUM = 4
>                OR (STATUS_NUM = 10 AND tipo_cobranca_id = 2 AND agente_emissor_id = 4)
>                OR (STATUS_NUM = 2 AND trunc(DATA_VENC) &lt; sysdate)
>                OR (STATUS_NUM = 11 AND TRUNC(BA.DATA_VENCIMENTO + #limiteDiasPosEmissaoBoletoAvulso:NUMERIC#) &lt; TRUNC(SYSDATE) ) )
>    </statement>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira