Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 53632 invoked from network); 9 May 2008 14:13:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 May 2008 14:13:19 -0000 Received: (qmail 27714 invoked by uid 500); 9 May 2008 14:13:18 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 27701 invoked by uid 500); 9 May 2008 14:13:17 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 27690 invoked by uid 99); 9 May 2008 14:13:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 May 2008 07:13:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of oconnell@gorillachicago.com designates 206.40.48.197 as permitted sender) Received: from [206.40.48.197] (HELO mail12.intermedia.net) (206.40.48.197) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 May 2008 14:12:31 +0000 Received: from oconnell2 (unknown [75.146.115.137]) (Authenticated sender: oconnell@gorillachicago.com) by mail12.intermedia.net (Postfix) with ESMTP id D232E6765C for ; Fri, 9 May 2008 07:12:45 -0700 (PDT) From: "Chris O'Connell" To: References: <17093837.post@talk.nabble.com> <17106214.post@talk.nabble.com> <17110744.post@talk.nabble.com> <588283.75112.qm@web54506.mail.re2.yahoo.com> <17111540.post@talk.nabble.com> <00b201c8b157$6e6ce300$4b46a900$@com> <00b401c8b159$dbbf9270$933eb750$@com> In-Reply-To: Subject: RE: How to get the generated key from insert with Oracle Date: Fri, 9 May 2008 09:12:46 -0500 Message-ID: <00bf01c8b1de$c248b4e0$46da1ea0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcixXECprqV87dqgTJGv+DHEs1040gAgctTA Content-Language: en-us X-Virus-Checked: Checked by ClamAV on apache.org Thanks. I had never heard this before. Just to make sure we are talking about the same thing, I'm not concerned about the sequence returning the same value to two different people when the trigger is calling 'nextval'. I'm worried about the fact that two inserts could happen before my code that tries to call "sequence.currvalue" can execute for the first insert and I end up with two difference insert actions that get the same value for "sequence.currvalue". It isn't that I don't believe you :) but this is counter to what I *thought* I knew, so I'm trying to get a full understanding of what is going on. Thanks, Chris -----Original Message----- From: Larry Meadors [mailto:larry.meadors@gmail.com] Sent: Thursday, May 08, 2008 5:38 PM To: user-java@ibatis.apache.org Subject: Re: How to get the generated key from insert with Oracle Not with a sequence, I've been told that they are 'session' aware, so if you get id 123 in your session, no one else ever will. Larry On Thu, May 8, 2008 at 4:21 PM, Chris O'Connell wrote: > Even if I am executing all of this inside a transaction, don't I still have > concurrency issues with this approach? > > > > -----Original Message----- > From: Larry Meadors [mailto:larry.meadors@gmail.com] > Sent: Thursday, May 08, 2008 5:12 PM > To: user-java@ibatis.apache.org > Subject: Re: How to get the generated key from insert with Oracle > > I think this would be the preferred SQL for that: > > select ids.currval from dual > > ...where ids is your sequence's name. > > Larry > No virus found in this incoming message. > Checked by AVG. > Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date: 5/7/2008 > 5:23 PM > > No virus found in this incoming message. Checked by AVG. Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date: 5/7/2008 5:23 PM