- 普通字段上自动生成UUID (本机5.6.21-log无法使用,公司5.5.20-5.5.20 测试成功)
```java
/**
- 全系统唯一 */ @Column(length = 36) @ApiModelProperty(value=”uuid”) @GeneratedValue(generator = “uuid”) @GenericGenerator(name = “uuid”, strategy = “org.hibernate.id.UUIDGenerator”) private String uuid; }
数据库中生成的UUID: 612e8922d17740b38aa7bf628cb722dc
2. 自增长 ID 做 UUD
[参考-未验证](https://blog.csdn.net/qq_36367789/article/details/81711174)
```java
@Entity
@Table(name = "ip_user")
/**
* uuid关键
*/
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class User implements Serializable {
@Id
@GeneratedValue(generator = "jpa-uuid")
@Column(length = 32)
private String userId;
...
}