oracle 自增序列 在 mybatis中应用

创建自增序列:
create sequence SEQ_INCREMENT_LOG

increment by 1
start with 1 
minvalue 1
maxvalue 999999999;

查询oracle自增序列:

select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences  where sequence_owner=‘PPNIE‘;

xml片段:

  <insert id="insert" parameterType="cn.com.soft.domain.IncrementLog">
    <selectKey keyProperty="id" order="BEFORE" resultType="long">
      select SEQ_INCREMENT_LOG.NEXTVAL as id from dual
    </selectKey>
    insert into INCREMENT_LOG (ID, NAME, OPERAT_TM, 
      OPERAT_TYPE, DATA_TOTAL, DATE_TM, 
      SUCCESS_FLAG, NOTE, DATA_FILE_NAME, 
      MAPPING_FILE_NAME, OPERAT_START, OPERAT_END
      )
    values (#{id,jdbcType=DECIMAL}, #{name,jdbcType=VARCHAR}, #{operatTm,jdbcType=TIMESTAMP}, 
      #{operatType,jdbcType=VARCHAR}, #{dataTotal,jdbcType=DECIMAL}, #{dateTm,jdbcType=TIMESTAMP}, 
      #{successFlag,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{dataFileName,jdbcType=VARCHAR}, 
      #{mappingFileName,jdbcType=VARCHAR}, #{operatStart,jdbcType=TIMESTAMP}, #{operatEnd,jdbcType=TIMESTAMP}
      )
  </insert>

 

oracle 自增序列 在 mybatis中应用

上一篇:数据库与实例的关系


下一篇:c#网络传输