hibernate annotation生成uuid主键(id为string类型的)
时间:2015-01-27 18:04:17
收藏:0
阅读:2284
JPA标准方式下,不可以生成uuid类型的主键,但是hibernate提供了一些方式生成uuid主键,具体方式,
1,通过注解方式生成一个generator
@GenericGenerator(name="idGenerator", strategy="uuid")
2.主键生成器
@GeneratedValue(generator="idGenerator")
评论(0)