Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 89236 invoked from network); 17 May 2005 22:40:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 May 2005 22:40:48 -0000 Received: (qmail 24371 invoked by uid 500); 17 May 2005 15:57:31 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 24193 invoked by uid 500); 17 May 2005 15:57:28 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 24160 invoked by uid 99); 17 May 2005 15:57:26 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of martin.davidsson@gmail.com designates 64.233.184.207 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.207) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 17 May 2005 08:57:26 -0700 Received: by wproxy.gmail.com with SMTP id 58so2371432wri for ; Tue, 17 May 2005 08:56:50 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=rFPa8rvbb/3rYnH5+yPYJe1s+UFSUEATVTT+Yq+ZnGT7ffjPRr3+vqz6uX5gRN0YPZNrORMYxOfvp9oqkfZ/mK0cp+mnFjKwk8GrhNLygWgGPZ3fZ0nEHWHBv2/bbAFYJVQQZXo48SD14GXhtC8gEQi09ZmKZrrBqVRjh+7vEUI= Received: by 10.54.125.20 with SMTP id x20mr4431892wrc; Tue, 17 May 2005 08:50:10 -0700 (PDT) Received: from ?192.168.168.2? ([152.1.78.182]) by mx.gmail.com with ESMTP id g12sm524140wra.2005.05.17.08.50.10; Tue, 17 May 2005 08:50:10 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v728) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: ojb-dev@db.apache.org From: Martin Davidsson Subject: Write lock where Read expected Date: Tue, 17 May 2005 11:50:10 -0400 X-Mailer: Apple Mail (2.728) X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello, I upgraded to OJB version 1.0.3 and started seeing some new exceptions during run-time. OJB said it was unable to perform a WRITE lock on some of my objects. I didn't expect a WRITE lock to be necessary at all in this particular situation since I was pulling up a page on my site that doesn't perform any modifications to the database. I traced the source and got to the org/apache/ojb/odmg/oql/ OQLQueryImpl.java file. On line 329 we have the statement "tx.lockAndRegister(rt, Transaction.WRITE, true);" despite multiple comments above it pointing to the fact that a READ lock should occur. I tried changing Transaction.WRITE to Transaction.READ and my problems went away, but perhaps this statement should in fact be the way it's pasted below and it's just that the comments are throwing me off. I was wondering if anybody on the list could set me straight. Also, were there ever any plans to create a DSetImpl_2... similar to the old DListImpl_2? Thank you! Here is the relevant function in context: protected void performLockingIfRequired( TransactionImpl tx, PersistenceBroker broker, ManageableCollection result) { // if tx is available and implicit locking is required, // we do READ-lock all found objects if ((tx != null) && tx.isImplicitLocking() && tx.isOpen()) { // read-lock all resulting objects to the current transaction Iterator iter = result.ojbIterator(); Object toBeLocked = null; try { while (iter.hasNext()) { toBeLocked = iter.next(); RuntimeObject rt = new RuntimeObject(toBeLocked, tx, false); tx.lockAndRegister(rt, Transaction.WRITE, true); } } finally { tx.lockAndRegisterCleanup(); } } } -- Martin Davidsson --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org