Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 23712 invoked from network); 4 May 2009 11:34:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 May 2009 11:34:41 -0000 Received: (qmail 95714 invoked by uid 500); 4 May 2009 11:34:41 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 95638 invoked by uid 500); 4 May 2009 11:34:40 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 95630 invoked by uid 99); 4 May 2009 11:34:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2009 11:34:40 +0000 X-ASF-Spam-Status: No, hits=1.1 required=10.0 tests=FORGED_HOTMAIL_RCVD2,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 May 2009 11:34:32 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1M0wR1-0002g2-Bp for derby-user@db.apache.org; Mon, 04 May 2009 04:34:11 -0700 Message-ID: <23366698.post@talk.nabble.com> Date: Mon, 4 May 2009 04:34:11 -0700 (PDT) From: wfalby To: derby-user@db.apache.org Subject: Re: Row Locking In-Reply-To: <49FD6FBD.1040109@Sun.COM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: wfalby@hotmail.com References: <23333804.post@talk.nabble.com> <49FD6FBD.1040109@Sun.COM> X-Virus-Checked: Checked by ClamAV on apache.org Kristian Waagan-4 wrote: > > wfalby wrote: >> My application processes events. These events are sent to registered >> users. >> These events can be deleted when they reach a certain age. There is a >> thread >> to send events to registered users and there is another thread to delete >> old >> events. The thread sending an event should lock it from the thread that >> deletes old events. Each thread uses its own connection to the database. >> In >> the sending thread, I've tried using a SELECT ... FOR UPDATE and setting >> the >> ResultSet.CONCUR_UPDATABLE on the prepare statement. In both cases, the >> thread that deletes events deleted the event being held by the sending >> thread. The default isolation level and autocommit options are used. >> > > Hi Walter, > > If you're using the read committed isolation level, I think you need to > use SELECT ... FOR UPDATE WITH RS. > Which behavior do you see if you do that? > > I think Derby treats SELECT ... FOR UPDATE a bit differently than some > other database systems, and I also believe there is at least one Jira > [1] issue logged for changing the behavior. > > > Regards, > -- > Kristian > > [1] https://issues.apache.org/jira/browse/DERBY >> Thanks in advance...Walter >> > > > Kristian: Thanks for the info. I tried your suggestion, but all rows are deleted. I'll check the Jira issue to see if it fits my situation. Walter -- View this message in context: http://www.nabble.com/Row-Locking-tp23333804p23366698.html Sent from the Apache Derby Users mailing list archive at Nabble.com.