Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 22454 invoked from network); 19 Mar 2010 05:21:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Mar 2010 05:21:21 -0000 Received: (qmail 51161 invoked by uid 500); 19 Mar 2010 05:21:20 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 50976 invoked by uid 500); 19 Mar 2010 05:21:20 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 50968 invoked by uid 99); 19 Mar 2010 05:21:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Mar 2010 05:21:19 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Mar 2010 05:21:11 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NsUde-0006Id-Uu for user-java@ibatis.apache.org; Thu, 18 Mar 2010 22:20:50 -0700 Message-ID: <27950897.post@talk.nabble.com> Date: Thu, 18 Mar 2010 22:20:50 -0700 (PDT) From: lawouc To: user-java@ibatis.apache.org Subject: Re: Missing commit after select won't update cache In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: jason@lawcasa.com References: X-Virus-Checked: Checked by ClamAV on apache.org I'm experiencing the same issue as Bj=C3=B6rn. Can someone tell me if issu= ing a session.commit(); is the proper way to ensure the results of a query are cached? Is there any round trip to the database with an iBatis commit afte= r a select? If not, then I'll modify my code to commit after every statement= , not just Inserts, Updates, and Deletes. If there is a database call associated with a commit after a select, then that would be inefficient, at least in the Oracle world. I'm also using iBatis 3 beta 10. Many thanks. [e2n] software | Bj=C3=B6rn Raupach wrote: >=20 > Hello, >=20 > just wanted to check if this behavior is on purpose.=20 >=20 > For select Statements I use the following construct in my DAO. >=20 > public List selectJobs() { > =09List resultList =3D null; > =09SqlSession session =3D getSqlSessionFactory().openSession(); > =09try { > =09=09JobMapper mapper =3D session.getMapper(JobMapper.class); > =09=09resultList =3D mapper.selectJobs(); > =09} finally { > =09=09session.close(); > =09} > =09return resultList; > } >=20 > is set in the JobMapper.xml. >=20 > Calling this method twice in my Unit Test results the following Log > Message: > // first call > org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio > [de.zmi.data.batis.JobMapper]: 0.0 > // second call > org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio > [de.zmi.data.batis.JobMapper]: 0.0 >=20 > Appending session.commit() after mapper.selectJobs() results in: > // first call > org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio > [de.zmi.data.batis.JobMapper]: 0.0 > // second call > org.apache.ibatis.cache.decorators.LoggingCache - Cache Hit Ratio > [de.zmi.data.batis.JobMapper]: 0.5 >=20 > So the second call is using the cache. I thought commit is only needed fo= r > update/insert or delete statements. >=20 > I am using iBatis 3 - Beta 10. >=20 > with kind regards > Bj=C3=B6rn >=20 >=20 --=20 View this message in context: http://old.nabble.com/Missing-commit-after-se= lect-won%27t-update-cache-tp27930507p27950897.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org For additional commands, e-mail: user-java-help@ibatis.apache.org