You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Mitchell, Steven C" <St...@umb.com> on 2005/06/27 21:06:39 UTC

Post Generated Keys

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?

Re: Post Generated Keys

Posted by Larry Meadors <la...@gmail.com>.
Use sequence.currval instead.

On 6/27/05, Mitchell, Steven C <St...@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?