X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F69852A55 for ; Wed, 9 Mar 2005 19:08:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15931-02 for ; Wed, 9 Mar 2005 19:08:05 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.196]) by svr1.postgresql.org (Postfix) with ESMTP id 040AE56542 for ; Wed, 9 Mar 2005 19:08:04 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id c51so237301rne for ; Wed, 09 Mar 2005 11:08:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=pZlHWAYaHBxDPtCN3LvM4xUFsNG1aPIIcj4+UWIa3SV83AmOM3n3TLOlWcSI6nLfYYb+SEvPVZQMrpfwcHWZhnqLCEZxr1nKBUQQYHdXYk5x9RrVAGgqSxDHvrw/4+wTBZOAh3OdzFNc5P7vWEJJD1ONUjIhbziNWX0aszE0/fk= Received: by 10.38.88.22 with SMTP id l22mr1088742rnb; Wed, 09 Mar 2005 11:08:04 -0800 (PST) Received: from ?138.232.9.21? ([138.232.9.21]) by mx.gmail.com with ESMTP id 64sm1052969rna.2005.03.09.11.08.03; Wed, 09 Mar 2005 11:08:04 -0800 (PST) Message-ID: <422F4991.50408@gmail.com> Date: Wed, 09 Mar 2005 20:08:01 +0100 From: Mican Bican User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: jdbc mailinglist Subject: Re: java is locked when select for update References: <915cd3880503081437272e5cfb@mail.gmail.com> <915cd38805030907545882333f@mail.gmail.com> <1110384760.2838.56.camel@coppola.muc.ecircle.de> <915cd38805030908299beca3c@mail.gmail.com> <1110386672.2838.65.camel@coppola.muc.ecircle.de> In-Reply-To: <1110386672.2838.65.camel@coppola.muc.ecircle.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.727 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200503/92 X-Sequence-Number: 12484 I think I dont understand for what I can use than "select for update" when not for the following scenario??--> For example when I have a table A with row a1 and user u1 will update a1 so he select a1 for update... and this without a commit till the user change values of a1 and commit this with a GUI button.. so when an other user u2 will also update a2 then I expect that a SQLException is throw like :"an other user is selected this row for update" OR he get the exception when u2 want commit a "select for update" before a1 do this... hmm.. > > > >I can't see why you couldn't insert the user in a first transaction and >the addresses in further transactions... if the user gets deleted in the >meantime by somebody else, then inserting the address will fail and you >will tell the user about the error. And if you don't want other people >to see the new user before it is committed with all it's addresses, then >collect first the user data + all the address data, and then open a >transaction and insert the user and the addresses when the user presses >OK. The point is that there should not be any GUI activity between the >start and end of a transaction. >If you really need a lock (I doubt it) between updates, implement it >using some application logic, don't use the DB row locking for long >living locks. I think there is some locking helper in the contrib >modules of postgres, or if not, read up on resource locking on google. > >Cheers, >Csaba. > > > > >