使用uuid为主键,只需要在主键的get方法上添加以下注解,并且主键的类型需要是string类型
@Id
@GeneratedValue(generator = "uuidGenerator")
@GenericGenerator(name = "uuidGenerator", strategy = "uuid")
本文介绍如何在项目中使用UUID作为主键,通过特定注解实现自动生成唯一标识符。
使用uuid为主键,只需要在主键的get方法上添加以下注解,并且主键的类型需要是string类型
@Id
@GeneratedValue(generator = "uuidGenerator")
@GenericGenerator(name = "uuidGenerator", strategy = "uuid")
转载于:https://my.oschina.net/u/3886184/blog/1930574
526
2万+

被折叠的 条评论
为什么被折叠?