-->
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.  [ 2 posts ] 
Author Message
 Post subject: Customer Identifier
PostPosted: Wed Feb 07, 2007 3:14 pm 
Newbie

Joined: Wed Feb 07, 2007 3:06 pm
Posts: 3
We are using a unique way of deriving Global ID's on our tables, because we have several individual locations that are now harvesting information bac to a central location. Each location has a unique Id (SalonId) and each table has an incrementor ID (Object Id) To identify this object globally we use the following code:

private long Generate(int _salonId, int _objectId) {
try {
if (_objectId < 0) {
_salonId++;
}
Int64 GlobalId = System.Convert.ToInt64(_salonId);
GlobalId = (GlobalId << 32) + System.Convert.ToInt64(_objectId);
return (long)GlobalId;
} catch (Exception ex) {
throw new Exception("GlobalId Generation failed: salonId" + _salonId + " objectId:" + _objectId, ex);
}
}

Because of a change in scope I now need these GlobalId to be used locally and genertered automatically when creating new records. The problem is I do not yet have a ObjectId unitl Save, also we need to use these GlobalId as contraint Fields.

My question is how can I create a customer Id Generator Class that can Generate these Id's and allow me to automatically create them on Save. An then support relationships and cascading?

Thank You.

Toby


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 1:41 am 
Regular
Regular

Joined: Tue Feb 21, 2006 9:50 am
Posts: 107
why don't you use Guid's as identifier? These are unique over different systems per definition. So you can avoid defining a custom identifier.

Regards
Klaus


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