java – 如何使用UUID与Hibernate作为字段?
发布时间:2020-12-14 05:04:43 所属栏目:Java 来源:网络整理
导读:我试图使用没有@Id注释的生成的UUID,因为我的主键是别的东西.应用程序不会生成UUID,你有想法吗? 这是我的声明: @Column(name = "APP_UUID",unique = true)@GeneratedValue(generator="system-uuid")@GenericGenerator(name="system-uuid",strategy = "uuid
我试图使用没有@Id注释的生成的UUID,因为我的主键是别的东西.应用程序不会生成UUID,你有想法吗?
这是我的声明: @Column(name = "APP_UUID",unique = true) @GeneratedValue(generator="system-uuid") @GenericGenerator(name="system-uuid",strategy = "uuid") private String uuid; 我正在使用Hibernate 4.3.0与Oracle10g. 解决方法
尝试这可能有帮助
@Id @GeneratedValue(generator = "hibernate-uuid") @GenericGenerator(name = "uuid",strategy = "uuid2") @Column(name = "uuid",unique = true) private String uuid; 读这个link读取hibernate文件是可能的 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |