ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Hicks" <alan.hi...@omega.ie>
Subject Re: Getting auto-generated keys in mySql
Date Wed, 17 Aug 2005 21:16:38 GMT
Hi Brian,

I had the same problem and could not find any working examples. Finally I  
stumbled upon
the query where 'userId' is an auto-generated key in my mysql table. If  
you replace the
query you have with this one you should be in business.


SELECT MAX(userId) FROM tb_user


Hope this helps.

Alan.



On Wed, 17 Aug 2005 21:43:05 +0100, Barnett, Brian W.  
<brian.barnett@pearson.com> wrote:

> We've been using SQL Server and are moving to mySQL. Can somebody tell me
> how to do this for mySql:
>
> <selectKey resultClass="int" keyProperty="id">
> 	SELECT @@IDENTITY AS id
> </selectKey>
>
> TIA,
> Brian Barnett
>
> ****************************************************************************
> This email may contain confidential material.
> If you were not an intended recipient,
> Please notify the sender and delete all copies.
> We may monitor email to and from our network.
> ****************************************************************************
>
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Mime
View raw message