mybatis+oracle 插入一条数据返回主键

插入数据后返回主键id

<insert id="insert" parameterType="com.neusoft.travel.dao.pojopublic.EmailFeedbackEntity" >

  <selectKey resultType="java.lang.Long" keyProperty="id" order="BEFORE">

   select email_sequence.nextval from dual

  </selectKey>

       insert into fk.email_feedback (mail,employee_code,state)

  values (#{mail,jdbcType=VARCHAR}, #{employee_code,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER})

</insert>

posted @ 2018-06-14 19:40  andys  阅读(927)  评论(0编辑  收藏  举报