mybatis insert后返回ID

首先,为了在添加记录时能获取到记录主键id,必须在<insert>的xml配置中添加3个属性:html <insert useGeneratedKeys="true" keyProperty="你的实体类id" keyColumn="你的表id"></insert> useGeneratedKeys:必须设置为true,不然没法获取到主键id。 keyProperty:设置为POJO对象的主键id
相关文章
相关标签/搜索