Invalid HEX number while inserting UUID

ⅰ亾dé卋堺 提交于 2021-01-28 01:53:36

问题


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;

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

May I know what is that issue?


回答1:


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

@Type(type="uuid-binary")

instead of

@Type(type="uuid-char") 


来源:https://stackoverflow.com/questions/17985893/invalid-hex-number-while-inserting-uuid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!