xiangjinqi 发表于 2013-1-30 01:28:04

【postgre数据库】如果新纪录的id是sequence方式生成的,如何得到新增加记录的id值

<insert id="addProductGroup" parameterClass="com.yihaodian.pcs.dto.TProductGroupDTO">INSERT INTOpisdb.t_product_group(group_name, remark,add_date,add_person,update_date)VALUES (#groupName#,#remark#,NOW(),#addPerson#,NOW()) ;   <!-- PostgreSQL -->       <selectKey keyProperty="id" resultClass="java.lang.Integer" type="post">          SELECT CURRVAL('PISDB.T_PRODUCT_GROUP_ID_SEQ'::REGCLASS) AS ID;    </selectKey></insert> 
 
其中PISDB.T_PRODUCT_GROUP_ID_SEQ就是 postgre数据库里你要插入记录的序列的名字
页: [1]
查看完整版本: 【postgre数据库】如果新纪录的id是sequence方式生成的,如何得到新增加记录的id值