Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 95356 invoked from network); 19 Aug 2006 07:08:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Aug 2006 07:08:57 -0000 Received: (qmail 56205 invoked by uid 500); 19 Aug 2006 07:08:57 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 56073 invoked by uid 500); 19 Aug 2006 07:08:56 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 97142 invoked by uid 99); 17 Aug 2006 10:21:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) From: "Luciano Medina" To: Subject: Feedback on "Managers and Caching" reference page Date: Thu, 17 Aug 2006 12:22:06 +0200 Message-ID: <000001c6c1e6$fda97d60$a002a8c0@CHUBUT> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0001_01C6C1F7.C1324D60" X-Mailer: Microsoft Office Outlook 11 thread-index: AcbB5v0DXt04caLmSFmVtIHFRCjZ3Q== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 X-OriginalArrivalTime: 17 Aug 2006 10:27:55.0186 (UTC) FILETIME=[CD416920:01C6C1E7] X-ExchangeSecure-AntiSpam: valid(2) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_NextPart_000_0001_01C6C1F7.C1324D60 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, =20 There is a mistake in the code samples of the "Managers and Caching" reference page. It is on section "Invalidating the Cache": =20 public void addedObject(Persistent om) { if (om instanceof Foo) { getMethodResult().removeAll(om, "getFoos"); } else if (om instanceof X) { getMethodResult().remove(om, GET_URLS); getMethodResult().removeAll(om, GET_COMMENTS); } ... } =20 The problem is the first parameter at the getMethodResult().removeAll = and getMethodResult().remove method calls. First, they will not compile = because om is a Persistent, while a Serializable is expected. Secondly, om is an instance of Foo (in the first case), but we want to invalidate the cache = for Bar, so the appropriate Bar instance should be passed instead. The correct code should be something like this: =20 public void addedObject(Persistent om) { if (om instanceof Foo) { getMethodResult().removeAll(((Foo) om).getBar(), "getFoos"); } ... } =20 Actually, the if block must be surrounded with try/catch because Foo.getBar() throws a TorqueException. =20 =20 Luciano Medina -------------------------------------------------------------------------= ----------------------------------------------------------- Nota Legal: Este correo electronico puede contener informacion = estrictamente confidencial y es de uso exclusivo del destinatario, = quedando prohibida a cualquier otra persona su revelacion, copia, = distribucion, o el ejercicio de cualquier accion relativa a su = contenido. Si ha recibido este correo electronico por error, por favor, = conteste al remitente, y posteriormente proceda a borrarlo de su = sistema. Gracias por su colaboracion. Confidentiality notice: This e-mail message may contain confidential = and/or legally privileged information and is solely for the attention = and use of the intended recipient. Any disclosure, copying, distribution = or the taking of any action with relation to the contents of this = e-mail by any other person is strictly prohibited. If you believe that = this e-mail has been mistakenly sent to you, please reply to the sender = from whom you received the message in error and then delete the original = e-mail from your system. Thank you for your co-operation. -------------------------------------------------------------------------= ----------------------------------------------------------- ------=_NextPart_000_0001_01C6C1F7.C1324D60--