Mybatis中 sequence不能自增长

解决方案:

参考:

http://leeyee.github.io/blog/2013/08/22/mybatis-auto-increment-primary-key/

<insert id="addSupplier" parameterType="com.pinganfu.GouTong.common.dal.model.SmsSupplierDO" >

  <selectKey resultType="int" keyProperty="id" order="BEFORE">

   SELECT SEQ_SMS_SUPPLIER.nextval FROM dual

  </selectKey>

  INSERT INTO

  t_sms_supplier(id,supplierId,username,password,usestatus,connstatus,suppliername,supplieraddress)

  VALUES(#{id},#{supplierId,jdbcType=VARCHAR},

  #{username,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},

  #{useStatus,jdbcType=NUMERIC},#{connStatus,jdbcType=NUMERIC},

  #{supplierName,jdbcType=VARCHAR},#{supplierAddress,jdbcType=VARCHAR})

 </insert>

上一篇:SpringMVC实现查询功能


下一篇:Java [leetcode 24]Swap Nodes in Pairs