directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: [DAS] Unique IDs for Model Instances (Was Initial Context?)
Date Thu, 19 Apr 2007 15:53:27 GMT
Stefan, Emmanuel,

Excellent thoughts.

OK - I'll scrap that idea.
I saw something about generating a unique
id based on current time on onjava.com
I'll see if I can find that article.

Thanks,
- Ole



Emmanuel Lecharny wrote:
> Ole Ersoy a écrit :
> 
>> What should the RDN for each of these instances be?
> 
> Try to associate an *unique* key to each object, and used it
> 
>>
>>
>> We do that by getting the total number of children that
>> the context cn=accounts, cn=users, cn=example, ou=com
>> has, and then add 1.  So if there are 14 children, the
>> new child gets a surrogate key assigned to it which is
>> 15.
> 
> There is no way to get the number of entries in the server, but getting 
> all the entries and count them. Not really fast.
> Forget about your idea, it does not work.
> 
>>
>> Then we write the surrogate key, along with a descriptive human
>> readable/identifiable string (Like "Alex Karasulu") taken from one of 
>> the root object's attributes
> 
> Just use this object's attribute as the RDN.
> 
>> <snip>
> 
>> Originally I was was thinking generate a surrogate key using a hash,
> 
> Don't. Hash are not guaranteed to be unique. Java HashCode is just a 
> speedup for comparisons.
> o1.hashcode != o2.hashcode() => o1 != o2
> but
> o1.hashcode == o2.hashcode() does not implies that o1 == o2
> 
> Emmanuel
> 

Mime
View raw message