Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 88141 invoked from network); 6 Jun 2007 12:08:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jun 2007 12:08:29 -0000 Received: (qmail 30694 invoked by uid 500); 6 Jun 2007 12:08:29 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 30682 invoked by uid 500); 6 Jun 2007 12:08:29 -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 30671 invoked by uid 99); 6 Jun 2007 12:08:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2007 05:08:29 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [196.35.77.149] (HELO mfwjhe02.mfw.is.co.za) (196.35.77.149) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2007 05:08:25 -0700 Received: from as-smtp04.he.businessgateway.co.za (Not Verified[196.26.57.70]) by mfwjhe02.mfw.is.co.za with MailMarshal (v6,2,0,2977) id ; Wed, 06 Jun 2007 14:07:26 +0200 Received: from pascptwsmeind ([41.245.166.161]) by as-smtp04.he.businessgateway.co.za with Microsoft SMTPSVC(6.0.3790.1830); Wed, 6 Jun 2007 14:07:35 +0200 From: "Meindert" To: , Subject: RE: Cache object reference Date: Wed, 6 Jun 2007 14:07:41 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: Thread-Index: AceoKd0a3ylaD3MqQmq6Cq5j94FghgAB8z4w X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-ID: X-OriginalArrivalTime: 06 Jun 2007 12:07:35.0661 (UTC) FILETIME=[44EE39D0:01C7A833] X-Virus-Checked: Checked by ClamAV on apache.org Ah! Excellent that is better then cloning the result object! Thanks! Must say though, I don't understand the whole caching.. > In your cache definition, you have readonly="true", but are not > modifying the results. You are a very bad boy. Don't do that. :-) Readonly="true" is the default so I thought that is the 'normal' setting I have a readonly cache and are only reading (not modifying) the result, sounds right doesn't it? I also tried Readonly="false" but this (without serializable=true) did not 'fix' the issue. I flush the cache when I do an update. And therefore don't need to write to the cache? Am I misusing the cache functionality in this way? The example on page 42 of the developer guide states readOnly="true" serialize="false", this is a bad configuration? > because results will only be cached for the current iBATIS 'session' I'm running iBATIS in a web application, isn't there only one iBATIS 'session'? (When I start the web application for the first time) Kind Regards Meindert -----Original Message----- From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf Of Larry Meadors Sent: 06 June 2007 01:00 PM To: user-java@ibatis.apache.org Subject: Re: Cache object reference On 6/6/07, Meindert wrote: > Is it by design that the object returned from the cache has the same object > reference as the on in the cache? Yes, it is. This is intended to be a performance enhancing tweak for the brave, but in your case it is a misconfiguration. In your cache definition, you have readonly="true", but are not modifying the results. You are a very bad boy. Don't do that. :-) If you set serializable="true" and readonly="false" then the object is copied before being returned from the cache - assuming that the cached objects are serializable - if they are not, KABOOM! Note: If you set serializable="false" and readonly="false", you will lose a lot of caching benefits, because results will only be cached for the current iBATIS 'session', which is in 99.999% of cases, not what you want. Don't do that either. :-) Larry