插入时获取自增序列值

  

1     <!--插入-->
2     <insert id="insertMessage" parameterType="message" useGeneratedKeys="true" keyProperty="id">
3         INSERT INTO message (command, description, content) VALUES (#{command},#{description},#{content})
4     </insert>

 

会将MySQL生成的自增序列主键赋值给message的id属性

posted @ 2015-07-08 19:12  csnmd  阅读(525)  评论(0编辑  收藏  举报