-->
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.  [ 4 posts ] 
Author Message
 Post subject: Unique Id's - Are they global?
PostPosted: Tue Dec 09, 2003 11:59 am 
Beginner
Beginner

Joined: Wed Sep 17, 2003 10:25 am
Posts: 36
I have an application where multiple instances (of the application) are creating data that eventually need to be merged together. I was wondering if the uuid.hex generated id can be considered globally unique? The application runs in disconnected machines so the machine's IP address will not be unique for each machine in it disconnected state. Unless, uuid.hex also works with host name which is unique for each machine.

If uuid.hex will not get me the global uniqueness that I am looking for, how can I plug my own uuid generator in hibernate? Can someone provide and example?

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 12:37 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It can be considered as unique if:
- you don't start your JVM in the same quarter of second
- OR you don't generate unique ID in the same millisecond (minus your JVM precision in currentTimeMillis)

This is probably the best you can do wo using jni or reading a different seed for each JVM instance.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 12:47 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If you want to do your own,
Have a look at :
- section 5.1.4.1
- the source code of hibernate in net.sf.hibernate.id (and the UUIDGenerator class).

It's pretty simple.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2003 7:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
- you don't start your JVM in the same quarter of second


correct

Quote:
- OR you don't generate unique ID in the same millisecond (minus your JVM precision in currentTimeMillis)


which would be very difficult to guarantee

- OR you are on a single network, so you can guarantee that IP adresses are unique


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.