ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Fwd: Post Generated Keys
Date Tue, 28 Jun 2005 15:16:09 GMT
Oops...accidentally replied to Steven directly.

---------- Forwarded message ----------
From: Larry Meadors <larry.meadors@gmail.com>
Date: Jun 28, 2005 9:15 AM
Subject: Re: Post Generated Keys
To: "Mitchell, Steven C" <Steven.Mitchell@umb.com>

Yes, that is possible in an environment where updates happen
simultaneously if the driver does not make those calls local to the

I would be (unpleasantly) suprised if Oracle's driver fell into that
category. I know that DB2 does make them local to the transaction.

I am a fan of pre-generated keys for that very reason. :-)


On 6/28/05, Mitchell, Steven C <Steven.Mitchell@umb.com> wrote:
> Larry,
> Your suggestion of using sequence.currval works great.  I just left the
> ID column off of the insert statement.  I assume there is some risk of
> getting the wrong ID during simultaneous updates.  I'll get triggers
> turned off as soon as we cut over to the new application and go back to
> pre-generated keys with sequence.nextval.
> Thanks.
> Steve
> -----Original Message-----
> From: Larry Meadors [mailto:larry.meadors@gmail.com]
> Sent: Monday, June 27, 2005 2:51 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Post Generated Keys
> Use sequence.currval instead.
> On 6/27/05, Mitchell, Steven C <Steven.Mitchell@umb.com> wrote:
> >
> > I'm converting an Oracle application to iBatis.  I discovered that the
> > database is using triggers to generate ids (I was using
> > sequence.nextval and my ids were off by one).  The documentation says
> > iBatis supports both pre and post generated keys.  Is that true for
> > Oracle too?  The post-generated example is for SQL Server @@IDENTITY.
> > I would have the DBAs turn off the triggers, but I have to run in
> > parallel for some time.  Am I stuck doing a select on some other key
> > immediately following the insert to find out the generated ID?

View raw message