SSM+Oracle自动生成uuid作为主键

Posted uzxin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SSM+Oracle自动生成uuid作为主键相关的知识,希望对你有一定的参考价值。

oracle数据库获取uuid:select rawtohex(sys_guid()) from dual;

mapper.xml实例

 

<insert id="insert" parameterType="net.topcheer.module.entity.TsOperateLog">
    <selectKey resultType="String" keyProperty="id" order="BEFORE">
      select rawtohex(sys_guid()) from dual
    </selectKey>
    insert into TS_OPERATE_LOG (ID, OPERATE_USER_ID, OPERATE_USER_NAME,
                                IP, DEVICE, BROWSER, OPERATE_CONTENT)
    values (#{id,jdbcType=VARCHAR}, #{operateUserId,jdbcType=OTHER}, #{operateUserName,jdbcType=VARCHAR},
      #{ip,jdbcType=VARCHAR}, #{device,jdbcType=VARCHAR},
      #{browser,jdbcType=VARCHAR}, #{operateContent,jdbcType=VARCHAR})
  </insert>

 

以上是关于SSM+Oracle自动生成uuid作为主键的主要内容,如果未能解决你的问题,请参考以下文章