标签:test article nat 键值 http 操作 sql primary 针对
<insert id="AltName.insert" parameterType="AltName">
<selectKey resultType="long" keyProperty="id">
SELECT SEQ_TEST.NEXTVAL FROM DUAL
</selectKey>
insert into
altname(primaryName,alternateName,type)values(#{primaryName},#{alternateName},#{type})
</insert>
<insert id="AltName.insert" parameterType="AltName">
<selectKey resultType="long" keyProperty="id">
SELECT LAST_INSERT_ID()
</selectKey>
insert into
altname(primaryName,alternateName,type)values(#{primaryName},#{alternateName},#{type})
</insert>
当然,是否需要配置<selectKey>根据情况,只要能保证记录有主键即可。一旦配置了<selectKey>,就可以在执行插入操作时获取到新增记录的主键。
标签:test article nat 键值 http 操作 sql primary 针对
原文地址:http://www.cnblogs.com/1210272526lww/p/7153162.html