|
I have some existing data that I would like to preserve in a Derby Database. Previously it used derby's identity column feature to generate primary key values.
I want to migrate to Hibernate, so I will have to remove the auto generated key values from the columns, and let Hibernate's TableHiLoGenerator take over. Will this work w/o intervention? Or will the the generator end up creating id's that are likely to collide with the existing data?
Should I use a different generator? If so, which one, and how do I work with it (or around it) to make the two worlds work together?
Thanks
*edit* ok... The answer is a definite no. I tried a small test where the table had 4 hand inserted rows in it, and then tried letting hibernate insert an entity. BOOM. :(
Hints on work arounds would be appreciated.
*edit* *edit*
I think what's going on here is that the id's generated are a multiple of the value in the hibernate unique id table, and a multiple of either max_lo (if configured via. mapping), or SHORT_MAX if max_lo is not set. And one way to keep myself out of trouble is to seed the table with a value that will end up generating id's higher than any id's I may already have.
Does that sound correct?
|