ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guido García Bernardo <ggb...@tid.es>
Subject Re: handle auto_increment insert into mysql
Date Wed, 16 Nov 2005 15:08:55 GMT
Your problem has been discussed previously on this list 

Use the <selectKey ...> tag.

<insert id="insertFolder" parameterClass="folder">
  INSERT INTO folder (parent_id, owner, foldername)
  VALUES (#parentId#, #owner#, #foldername#)
  <selectKey resultClass="int" keyProperty="folderId">

Good luck,

Scott Purcell wrote:

>I am trying to get the hang of using IBATIS. In order to get my hands wet I am running
the reumann struts lesson. It is working, and I am trying to add some tables to the example,
to get a feel for the framework.
>But one of the tables has an "auto_increment" (mysql) on it. So when I do an insert, I
am unsure how to handle this. Could someone lead me to where I find information on handling
Guido García Bernardo - ggarciab@itdeusto.com
Tfn. +34 983 54 89 08
ITDEUSTO - Valladolid (Spain)

View raw message