关于Hibernate的主键类型:uuid

JasonSen 2011-11-16

升级到3.6.0后关于UUID的警告

原来的UUIDHexGenerator已不推荐使用,应用UUIDGenerator替代。

@GenericGenerator(name="system-uuid",strategy="uuid")

改为

@GenericGenerator(name="system-uuid",strategy="org.hibernate.id.UUIDGenerator")

//---------------------------------------------------------------------
@Id
@GeneratedValue(generator = "system-uuid")   
@GenericGenerator(name = "system-uuid", strategy = "org.hibernate.id.UUIDGenerator") 
//---------------------------------------------------------------------
//---------------------------------------------------------------------
@GenericGenerator(name = "generator", strategy = "org.hibernate.id.UUIDGenerator")
@Id
@GeneratedValue(generator = "generator")
//---------------------------------------------------------------------

一些版本是:org.hibernate.id.UUIDHexGenerator

但是得看jar才知道。

以前版本:

http://lipeng88213.iteye.com/blog/556010

http://blog.sina.com.cn/s/blog_694448320100o2zd.html

主键详解:

http://hi.baidu.com/zhaoyu1988312/blog/item/e9155b303df7f48fa8018e7c.html

相关推荐