日期:2014-05-20  浏览次数:20634 次

ibatis
ibatis中若使用mysql数据库,插入数据的时候 怎么使用自动增长列 更为兄弟姐妹帮忙啊!!最好有源码

------解决方案--------------------
哥,主键设为自动增长不行吗
------解决方案--------------------
<insert>里面有个<selectKey>
<insert id="insertProduct-Mysql" parameterClass="com.domain.Product">

  insert into PRODUCT(PRD_DESCRIPTION)

  values (#description#)

  <selectKey resultClass="int" keyProperty="id">

  SELECT LAST_INSERT_ID()

  </selectKey>

  </insert>
------解决方案--------------------
auto_increment
------解决方案--------------------
你把mysql ID设成自动增长 不用管他的