ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: Obtaining Generated Primary Keys
Date Fri, 15 Sep 2006 13:59:41 GMT
David,

You can still use the selectKey element in your insert if you have
some way (other than the generated key) of uniquely identifying the
inserted data.

<insert ...>
  insert into blah blah blah
  <selectKey property="yourIdPropertyName" ...>
    select your_id from blah blah blah
  </selectKey>
</insert>

Then as long as you call insert() it should work.

Larry


On 9/15/06, David Hodge <dyhodge@gmail.com> wrote:
> I am using Oracle and I am wondering if there is a way to obtain a trigger
> generated Primary key after doing an INSERT with iBatis.
>
> I know there is a selectKey function but that seems to work only if you have
> a select statement, which makes sense.  Other databases have ways
> for you to select the last_generated_id() but I do not think Oracle has this
> capability.
>
> Has anyone else had this problem or know of a work around?
>
>
> Thanks,
>
> David Y. Hodge
>

Mime
View raw message