<insert id="add"
useGeneratedKeys="true" keyColumn="id" keyProperty="id"
parameterType="user">
INSERT INTO `user` (`name`,sex,register_ts) VALUES (#{name},#{sex},#{registerTs})
<selectKey resultType="int" keyProperty="id" order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
</insert>
数据能插入成功,但是总是返回1.
debug 数据插入的过程
19:01:24.389 [nioEventLoopGroup-3-1] DEBUG org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession
19:01:24.389 [nioEventLoopGroup-3-1] DEBUG org.mybatis.spring.SqlSessionUtils - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5521d0ca] was not registered for synchronization because synchronization is not active
19:01:24.390 [nioEventLoopGroup-3-1] DEBUG o.s.jdbc.datas