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: Value inserted in Fild
Date Tue, 19 Apr 2005 11:58:39 GMT
This has been discussed before in this list.

http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg00673.html
http://www.mail-archive.com/cgi-bin/htsearch?config=ibatis-user-java_incubator_apache_org&restrict=&exclude=&words=autoincrement+mysql

  <insert id="insertShow" parameterClass="show">
      insert into shows ( title, coverimage ) values ( #title#, #coverimage# )
      <selectKey resultClass="int" keyProperty="id">
      SELECT LAST_INSERT_ID()
      </selectKey>
  </insert>

regards
Guido García Bernardo

omarcioRibeiro() wrote:

>Personal good morning.  
>  
>I have a table in MySQL that contains a field AUTO_INCREMENT,  
>how can I recover the last value inserted in that field???
>
> SqlMapClient sqlMap = MyApp.getSqlMapInstance();
>      
>        try {
>            sqlMap.insert("insert_pesona",pesona);//
>                 } catch (SQLException e) {
>            return ERROR;
>               
>         
>        }
>  
>


-- 
Guido García Bernardo - ggarciab@itdeusto.com
Tfn. +34 983 54 89 08
ITDEUSTO - Valladolid


Mime
View raw message