Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 95923 invoked from network); 22 Apr 2004 06:13:15 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 22 Apr 2004 06:13:15 -0000 Received: (qmail 82391 invoked by uid 500); 22 Apr 2004 06:12:52 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 82142 invoked by uid 500); 22 Apr 2004 06:12:51 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 82106 invoked from network); 22 Apr 2004 06:12:50 -0000 Received: from unknown (HELO smtp.web.de) (217.72.192.209) by daedalus.apache.org with SMTP; 22 Apr 2004 06:12:50 -0000 Received: from p5090293f.dip.t-dialin.net ([80.144.41.63] helo=web.de) by smtp.web.de with asmtp (TLSv1:RC4-MD5:128) (WEB.DE 4.101 #91) id 1BGXSH-0004NL-00; Thu, 22 Apr 2004 08:13:02 +0200 Message-ID: <4087624E.3080308@web.de> Date: Thu, 22 Apr 2004 08:12:30 +0200 From: Thomas Mahler Reply-To: thma@apache.org Organization: Apache Foundation User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821 X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List CC: Benne@soptim.de Subject: Re: Fwd: PersistenceBroker.delete() for objects that use optimisitic locking References: <40749BE6.7090708@apache.org> <40842469.2000609@gmx.ch> <4086D1CC.2070206@gmx.ch> <4086E879.8000008@apache.org> In-Reply-To: <4086E879.8000008@apache.org> X-Enigmail-Version: 0.76.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: thma32@web.de X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N hi all, Armin Waibel wrote: > > I agree with your first suggestion only to throw the > OptimisticLockException. Optimistic locking should inform the user about > concurrent modification action and it doesn't matter (in my opinion ;-)) > whether it is a concurrent update or delete operation. We can modify the > error message and specify both reasons for the exception. It's no > problem for the user to detect the reason for the exception. > I'm +1 for this solution! Thomas > regards, > Armin > >> jakob >> >> >> Jakob Braeuchi wrote: >> >>> hi brian, armin, >>> >>> +1 for throwing the exception >>> >>> jakob >>> >>> Armin Waibel wrote: >>> >>>> Hi, >>>> >>>> >> If optimistic locking is enabled for some object class, >>>> >> PersistenceBroker.delete (object) cannot delete the object if it >>>> has >>>> >> been modified by another session. In current CVS version, delete >>>> >> statement generated for PB.delete() will be simply ignored (!). One >>>> >> have to use PB.deleteByQuery(...) for delete that bypasses stale >>>> >> object check. >>>> >> >>>> >>>> I think this is a strong argument to enable the exception to inform >>>> the user that the delete was not successful and the row still exists >>>> in DB. Then the user can refresh the object and try to delete again. >>>> >>>> Or the SqlGenerator implementation should never include the locking >>>> field in the delete where-clause. >>>> >>>> I would prefer the first solution, because this solution let the >>>> user decide what to do and avoid "dirty deletes". >>>> >>>> regards, >>>> Armin >>>> >>>> Brian McCallister wrote: >>>> >>>>> Forwarding from -users list >>>>> >>>>> Begin forwarded message: >>>>> >>>>>> From: "Andy Malakov" >>>>>> Date: April 7, 2004 1:49:19 PM EDT >>>>>> To: "OJB Users List" >>>>>> Subject: PersistenceBroker.delete() for objects that use >>>>>> optimisitic locking >>>>>> Reply-To: "OJB Users List" >>>>>> >>>>>> Hello All, >>>>>> >>>>>> It would be nice if sometime before 1.0 the following issue will >>>>>> be clarified or documented. >>>>>> >>>>>> If optimistic locking is enabled for some object class, >>>>>> PersistenceBroker.delete (object) cannot delete the object if it >>>>>> has been modified by another session. In current CVS version, >>>>>> delete statement generated for PB.delete() will be simply ignored >>>>>> (!). One have to use PB.deleteByQuery(...) for delete that >>>>>> bypasses stale object check. >>>>>> >>>>>> Before RC5 this situation was producing OptimisticLockException >>>>>> exception ("Object has been modified by someone else"). But in Dec >>>>>> 2003 Thomas commented it out: >>>>>> >>>>>> File: o.a.ojb.broker.accesslayer.JdbcAccessImpl.java (line 134): >>>>>> >>>>>> // @todo: clearify semantics >>>>>> // thma: the following check is not secure. The object could be >>>>>> deleted *or* changed. >>>>>> // if it was deleted it makes no sense to throw an OL exception. >>>>>> // does is make sense to throw an OL exception if the object was >>>>>> changed? >>>>>> if (stmt.executeUpdate() == 0 && cld.isLocking()) //BRJ >>>>>> { >>>>>> //throw new OptimisticLockException("Object has been modified by >>>>>> someone else", obj); >>>>>> } >>>>>> >>>>>> Thanks, >>>>>> Andy >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org >>>>> >>>>> >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>>> For additional commands, e-mail: ojb-dev-help@db.apache.org >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >>> For additional commands, e-mail: ojb-dev-help@db.apache.org >>> >>> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org