hibernate注解UUID主键生成策略 hibernate注解UUID主键生成策略

原文地址:https://blog.csdn.net/albertfly/article/details/52253314
hibernate注解UUID主键生成策略
首先,你要定义你所使用的Generator,如
@GenericGenerator(name = "idGenerator", strategy = "uuid")
然后才可以使用引用的方式来引用你定义好的Generator,如

@GeneratedValue(generator = "idGenerator")

实例如下

[html] view plain copy
  1. @Id  
  2. @GenericGenerator(name="systemUUID",strategy="uuid")  
  3. @GeneratedValue(generator="systemUUID")  
  4. @Column(name = "actid"insertable = trueupdatable = truenullable = false

猜你喜欢

转载自blog.csdn.net/budaoweng0609/article/details/80108821
今日推荐