These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: TableHiLoGenerator & existing pk values ok together?
PostPosted: Sun Jul 22, 2007 11:53 pm 
Newbie

Joined: Sun Jul 22, 2007 11:31 pm
Posts: 1
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.