hibernate annotation生成uuid主键(id为string类型的)

时间:2015-01-27 18:04:17   收藏:0   阅读:2284

hibernate annotation生成uuid主键

(2012-02-07 15:18:43)
标签:

uuid

主键

注解

杂谈

分类: javaWeb
JPA标准方式下,不可以生成uuid类型的主键,但是hibernate提供了一些方式生成uuid主键,具体方式,
1,通过注解方式生成一个generator
     @GenericGenerator(name="idGenerator", strategy="uuid")
2.主键生成器
     @GeneratedValue(generator="idGenerator")
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!