-->
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: Interesting Legacy Data Challenge
PostPosted: Fri Sep 09, 2005 4:37 pm 
Newbie

Joined: Wed Jan 05, 2005 12:30 pm
Posts: 17
Location: Philadelphia, PA
My system has one use case where it needs to insert into a table in a legacy SQL Server database. This table existed when the schema ran on a version of Sybase that did support identity columns. Some customers still use that version so 'just make it identity' is not a valid solution to my problem. As a result, I cannot use 'native' or 'identity' id generation. At least three other systems write to this table prohibiting use of standard 'increment'. The table does not offer any candidate keys that would allow me to use a 'select' id generator.

All current applications and the old version of my application used two-selects to calculate (Max(id) +1) and assign ids and then retried the transaction when an occasional blowup happened.

I could do this with a custom version of increment that performed a select every time. Would it be better to use 'assigned' and my own query to find MAX+1 rather than writing a custom generator?

In either case I am a little unclear on how risky it would be to implement retry logic when duplicate keys turned up (experience says this is less than 5% of the time). I'd prefer if inserts to this table could participate in a larger JTA transaction but that is looking iffy at the moment. Has anyone ever done successful retries of clear();begin();save();flush();commit();?

Has anyone dealt with similar issues, or any issues at all, with legacy tables and Max+1 id strategies?

I am running Hibernate 3.0.5 under JBoss 4.0.3 using the Session per JTA transaction pattern.


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.