zoukankan      html  css  js  c++  java
  • 实体类id的几种生成方式

        @Id
    // @GeneratedValue(strategy = GenerationType.AUTO) // 自增
    // @GeneratedValue(strategy = GenerationType.IDENTITY) // 自增
    // @GeneratedValue(strategy = GenerationType.TABLE) // 自增
    // @GeneratedValue(strategy = GenerationType.SEQUENCE) // MySQL报错
    @GeneratedValue(generator="system-uuid") //使用生成器
    @GenericGenerator(name="system-uuid",strategy="uuid2") // uuid2 格式 013faedd-d92b-4f30-a85f-be0a8a126090 ,完全随机
     //   @GenericGenerator(name="system-uuid",strategy="uuid2") // uuid  格式 ff8080816b4b86d5016b4b870e8f0033 ,只有后几位不一样,前边都一样,不完全随机

    @Column(name = "Id", nullable = false, length = 200)
    public String getId() {
    return id;
    }
  • 相关阅读:
    Linux文件权限
    Linux命令
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
  • 原文地址:https://www.cnblogs.com/fsqsec/p/11011788.html
Copyright © 2011-2022 走看看