hi enrique,
for mass-updates sql is still the best (at least the fastest) solution, but you'll have to clear the cache manually. keeping the cache up-to-date is quite difficult and would require picking the object from cache based on sql.
currently ojb does not provide mass-updates based on collection. keeping the cache up-to-date would be easier here, because ojb knows all affected objects.
jakob
Enrique Medina wrote:
Hi Armin,
So, if cache is bypassed in both cases, this will lead to an inconsistent object model unsynchronized with persistent storage, won't it?
The solution would be to take care of cache consistence by myself. But consider the following simple example:
UPDATE TABLE WHERE SOME_FIELD = SOME_VALUE
I want to execute this SQL directly, because if not, I would have to retrieve first all records, materialize them through OJB, call update one by one, just to have cache up-to-date. But this is a very poor strategy, isn't it?
And if I don't retrieve all the records, how can I inform the cache?
Also, is there a way to do a massive update, I mean, call an update for a collection where OJB would update all objects one by one?
Regards, Enrique Medina.
From: Armin Waibel <[EMAIL PROTECTED]>
Reply-To: "OJB Users List" <[EMAIL PROTECTED]>
To: OJB Users List <[EMAIL PROTECTED]>
Subject: Re: Update SQL & Cache
Date: Thu, 10 Jun 2004 20:09:55 +0200
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by mc11-f11.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Thu, 10 Jun 2004 11:10:42 -0700
Received: (qmail 9959 invoked by uid 500); 10 Jun 2004 18:09:46 -0000
Received: (qmail 9817 invoked by uid 99); 10 Jun 2004 18:09:44 -0000
Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Thu, 10 Jun 2004 11:09:44 -0700
Received: (qmail 18819 invoked from network); 10 Jun 2004 18:09:28 -0000
Received: from localhost.hyperreal.org (HELO ?127.0.0.1?) (127.0.0.1) by localhost.hyperreal.org with SMTP; 10 Jun 2004 18:09:28 -0000
X-Message-Info: JGTYoYF78jGPoeKAUO7ZNBLn6XgzqOja
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
List-Subscribe: <mailto:[EMAIL PROTECTED]>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Post: <mailto:[EMAIL PROTECTED]>
List-Id: "OJB Users List" <ojb-user.db.apache.org>
Delivered-To: mailing list [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502)
X-Accept-Language: en-us, en
References: <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]>
X-Spam-Rating: localhost.hyperreal.org 1.6.2 0/1000/N
X-Virus-Checked: Checked
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 10 Jun 2004 18:10:43.0512 (UTC) FILETIME=[3ED33380:01C44F16]
Hi Enrique,
Enrique Medina wrote:
My question is about executing a direct UPDATE SQL statement and cache management.
I have seen at the FAQs that it is possible to directly execute an SQL statement, through the java.sql.Connection or using a QueryBySQL object.
But what happens with cache in both cases?
The cache will be bypassed in both cases.
a) Directly through the java.sql.Connection --> What happens with cache? Because no OJB API is used, so it would became incosistent.
yes, in this case the user has to take care of cache consistence.
b) Using a QueryBySQL --> Does OJB manage the cache then? How is this done?
AFAIK currently not. We plan to synchronize cache when PB#deleteByQuery was called in 1.1 (by materialize the Identity objects of deleted rows before sql-update call is done and remove objects from cache first)
regards, Armin
Thanks in advance, Enrique Medina.
_________________________________________________________________
Descarga gratis la Barra de Herramientas de MSN http://www.msn.es/usuario/busqueda/barra?XAPID=2031&DI=1055&SU=http%3A//www.hotmail.com&HL=LINKTAG1OPENINGTEXT_MSNBH
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Reparaciones, servicios a domicilio, empresas, profesionales... Todo en la gu�a telef�nica de QDQ. http://qdq.msn.es/msn.cfm
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
