generating IDs in Oracle with hibernate backed ORM

前提是你 提交于 2019-12-25 00:47:31

问题


There is an old database which needs to be ported to a new one but the porting process will take significant time during which the old db will remain operational. In the old DB the IDs are sequential numbers in the new one we need globally unique identifiers which in case of hibernate we are (or were) going to generate using the hibernate's built in UUID generation. I have no idea about how it(hibernate's UUID) works and don't know if this is the same as the java's native UUID generation. Actually hibernate provides 2 uuid generation strategies (uuid and uuid2).

The problem is that if we use hibernates generation it's possible that there will be a collision between the hibernate generated IDs and the IDs coming from the old DB while it's still working. We are going to write a number of oracle procedures to help us "smartly" transfer the IDs from the old database to the new one but what ID generation technique we should use in those procedures so we don't have ID collisions with the IDs generated by hibernate?

We can use oracle's built in GUID generator or write a procedure in java and use java's native UUID generator. But nowhere it's written that those 2 won't produce collisions with hibernate generated IDs.

来源:https://stackoverflow.com/questions/7918233/generating-ids-in-oracle-with-hibernate-backed-orm

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