Ibatis插入数据返回主键Id

Ibatis插入数据返回主键Id的方法:

<insert id="addArtPreview" parameterClass="ArtPreview">
		insert into <include refid="artPreviewTable"/> 
		(picurl,title,summary,content) values(#picUrl#,#title#,#summary#,#content#)
		<selectKey resultClass="int" type="post" keyProperty="id">
			 select last_insert_id();
		</selectKey>
</insert>



你可能感兴趣的:(ibatis,主键)