zoukankan      html  css  js  c++  java
  • 自定义主键生成器

    KeyGenerator表示 主键生成器

    public interface KeyGenerator {

    /**
    * 获取主键
    * @return 成功返回自定义生成的主键,否则返回""
    */
    String get();

    }

    DefaultKeyGenerator表示默认的主键生成器:sf+日期时间(精确到毫秒)

    public class DefaultKeyGenerator implements KeyGenerator {

    /* (non-Javadoc)
    * @see jcsf.jdbc.dao.KeyGenerator#get()
    */

    public String get() {
    String result = "" ;

    synchronized(this){
    long key = System.currentTimeMillis();
    result = "sf_" + String.valueOf(key);
    }

    return result ;
    }

    }

    /**
    * ID    

    自定义递增方式  customer,

    @DataField(name = "ID", dataType = DataType.VARCHAR, chinese = "ID", sequenceName = "com.sf.example.dao_9.DefaultKeyGenerator" ,incrementType = IncrementType.customer,isNullable = false, isPrimaryKey = true)
    private String ID;

    -------------------------------------------------------------------------
    ## 极客时间全网最便宜最优惠购买方式,优惠券返现 百度网盘 微信关注公众号“选门好课”
    扫描下方二维码关注我的公众号"选门好课",与我一起交流知识
  • 相关阅读:
    WPF基础之内容控件
    WPF基础之路由事件
    WPF基础分享之布局
    JMeter操作手册
    Jmeter安装和配置
    UI自动化--Web Driver小结
    对于自动化测试框架的总结
    UI自动化--selenium webdriver
    postman断言
    接口测试工具---postman的基本使用
  • 原文地址:https://www.cnblogs.com/singworld/p/9724520.html
Copyright © 2011-2022 走看看