ORACLE RAW(16) 和 Hibernate UUID 生成的好例子

see*_*see 2 java hibernate oracle11g

我在设置 Hibernate 以使用 Oracle RAW(16) 获取 UUID 时遇到问题

网上有完美的例子吗?

1) 期待字符串但发现 RAW 2) 不长

目前我在oracle中使用String作为UUID,并使用varchar(36)。

我可以知道如何使用 RAW 和 UUID 类型来设置此 UUID

bio*_*nfo 5

甲骨文,

myUUID RAW(16) PK
Run Code Online (Sandbox Code Playgroud)

JPA/休眠,

@Id
@Type(type = "uuid-binary")
@GeneratedValue(generator = "myGUID")
@GenericGenerator(name = "myGUID", strategy = "uuid2")
@Column(name = "myUUID", length = 16, unique= true, nullable = false)
public UUID getMyUUID() {
    return uuid;
}
Run Code Online (Sandbox Code Playgroud)