ibatis insert之后返回主键

1.配置文件

   
           
               select seq_for_xx.Nextval from dual
           

            INSERT INTO xx(ID,ACCOUNTID,OSTEMPLATEID,VCPU,MEMORY,VMONAME,VMNUMBER,TAGS,PASSWORD,PREFIX,STARTDATE,ENDDATE,TZINDEX,SUBMITTIME,APPROVEDTIME,OS,STATE)
             VALUES(#id#,..)
   

2.java代码

   Integer id = (Integer)sqlMapClientTemplate.insert("xx", xx);

你可能感兴趣的:(ibatis)