Contents
see List<!--oracle -->
<insert id="insertSelectSeq" parameterType="com.model.Test">
INSERT INTO seq_test(idx,title)
VALUES(idx_test_seq.nextval,#{title})
<selectKey keyProperty="idx" resultType="Integer" order="AFTER">
SELECT idx_test_seq.currval FROM dual
</selectKey>
</insert>
<!--mysql-->
<insert id="insertSelectSeq" parameterType="com.model.Test">
INSERT INTO seq_test(title)
VALUES(#{title})
<selectKey keyProperty="idx" resultType="Integer" order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
</insert>
<!--mssql-->
<insert id="insertSelectSeq" parameterType="com.model.Test">
INSERT INTO seq_test(title)
VALUES(#{title})
<selectKey keyProperty="idx" resultType="Integer" order="AFTER">
SELECT IDENT_CURRENT('seq_test')
</selectKey>
</insert>
Comments ( 0 )