插入UUID时无效的HEX编号 [英] Invalid HEX number while inserting UUID

查看:57
本文介绍了插入UUID时无效的HEX编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在oracle中,我有一个DOC_ID列

In oracle I have a DOC_ID column

RAW(16) for my UUID/GUID

在休眠状态下,我以这种方式映射了

in hibernate I mapped it this way

@ID
@GeneratedValue(Generator= "uuid")
@GenericGenerator(name="uuid", strategy="uuid2")
@Type(type="uuid-char")
@Column(name="DOC_ID", unique= true)
private UUID id;

在插入过程中,它一直在抱怨ORA-01465:十六进制数字无效.

during insertion, it keeps complaining ORA-01465: invalid hex number.

我可以知道这是什么问题吗?

May I know what is that issue?

推荐答案

UUID的char表示形式为36个字符,而二进制表示形式为16个字节.尝试

A char representation of a UUID is 36 chars, whereas the binary representation is 16 bytes. Try with

@Type(type="uuid-binary")

代替

@Type(type="uuid-char") 

这篇关于插入UUID时无效的HEX编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆