![](/img/trans.png)
[英]ORA-01465: invalid hex number or data mismatch error using hibernate jpa and oracle in coalesce
[英]JPA UUID mapping for Oracle ORA-01465: invalid hex number
虽然此映射适用于 MySQL 保存对象:
@Id
private String id;
在 Oracle 上, ORA-01465: invalid hex number when I am saving my object.
这就是我创建 id 的方式: UUID.randomUUID().toString()
My app must support both MySQL 5 and Oracle 12. So I can add only some mysql / oracle specific adapters / extensions that could be easily turned off while switching from one db to another. 如果这意味着将它们绑定到特定数据库,我无法更改 JPA 实体代码。 它必须适用于两个数据库。
我该怎么做才能在从一个 MySQL 切换到 Oracle 时不会破坏应用程序?
只需从 UUID.randomUUID().toString() 中删除 '-' 例如,
UUID.randomUUID().toString().replaceAll("-","")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.