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: Auto_Increment MySQL
Date Thu, 13 Oct 2005 20:02:26 GMT
MySQL uses LAST_INSERT_ID().

http://opensource2.atlassian.com/confluence/oss/display/IBATIS/Environment+Specific+Information

Larry


On 10/13/05, Tsolak Barseghyan <tsolakbarseghyan@yahoo.com> wrote:
>
>
> Hi, I'm beginner with iBatis and want to know how to insert into MySQL
> database  table a row which primary key is 'Auto_Increment'   type and I
> want to be returned the id of my table like in this examples from "iBATIS
> Developer Guide".
>
>
>
>
>
> <!—Oracle SEQUENCE Example -->
>
> <insert id="insertProduct-ORACLE" parameterClass="com.domain.Product">
>
> <selectKey resultClass="int" >
>
> SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL
>
> </selectKey>
>
> insert into PRODUCT (PRD_ID,PRD_DESCRIPTION)
>
> values (#id#,#description#)
>
> </insert>
>
> <!— Microsoft SQL Server IDENTITY Column Example -->
>
> <insert id="insertProduct-MS-SQL" parameterClass="com.domain.Product">
>
> insert into PRODUCT (PRD_DESCRIPTION)
>
> values (#description#)
>
> <selectKey resultClass="int" >
>
> SELECT @@IDENTITY AS ID
>
> </selectKey>
>
> </insert>
>
>  ________________________________
>  Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
>
>
Mime
View raw message