-->
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.  [ 3 posts ] 
Author Message
 Post subject: Identity Generator
PostPosted: Fri Sep 30, 2005 1:38 pm 
Beginner
Beginner

Joined: Fri Mar 04, 2005 7:12 pm
Posts: 34
Hibernate version:
3.05

Name and version of the database you are using:
Multiple - so sequence support cannot be assumed

I am building distributed system with separate databases, same structure, that need to be combined into a larger database. However, each will be detached from the larger database most of the time. I have no legacy data so am interested in letting Hibernate manage all keys, etc.

I am using a long id, so I had envisioned simply starting the keys at different values, such as 100 million, 200 million, etc, so that the id would never clash between distributed systems, but replication would work properly to and from the central database. Sequences would seem the best approach, but our main database is SQl Server, which does not support sequences, and I want to remain portable.

I cannot find a relatively simple way to do this and am asking if someone can point me in the right direction.

Thank you in advance.

- Mike

_________________
J. Michael Dean, MD


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 6:02 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-declaration-id-generator

try guid or uuid . you won't need to worry about id collisions because there aren't that many atoms in the universe.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 7:50 pm 
Beginner
Beginner

Joined: Fri Mar 04, 2005 7:12 pm
Posts: 34
Thanks. Much better solution than where I was aimed before!

_________________
J. Michael Dean, MD


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

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.