Java – how to use UUID and Hibernate as fields?

I try to use the generated UUID without @ ID annotation because my primary key is something else Applications don't generate UUIDs. Do you have an idea?

This is my statement:

@Column(name = "APP_UUID",unique = true)
@GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid",strategy = "uuid")
private String uuid;

I am using hibernate 4.3 0 and Oracle10g

Solution

Trying this might help

@Id
@GeneratedValue(generator = "hibernate-uuid")
@GenericGenerator(name = "uuid",strategy = "uuid2")
@Column(name = "uuid",unique = true)
private String uuid;

It is possible to read the link and read the hibernate file

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>