db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: Generating UUIDs
Date Tue, 09 Jun 2009 16:23:21 GMT
Suran Jayathilaka wrote:
> Hi,
>
> I want to generate a few UUIDs for the SYSSequences and SYSPerms 
> Catalog row factories which I'm adding as part of the sequence 
> generators work.
> I'm having some trouble with generating UUIDs using BasicUUIDFactory. 
> I tried following the T-UUIDFactory test but that didn't work becaue 
> the Monitor object was null.
>
> Can someone please point me in the right direction for achieveing this?
>
> Thanks!
> Suran
Hi Suran,

I suggest constructing a BasicUUID directly without going through the 
factory. Try the following:

import org.apache.derby.impl.services.uuid.BasicUUID;
public class UUIDMaker
{
    public static void main( String[] args )
        throws Exception
    {
        BasicUUID uuid = new BasicUUID( 
Runtime.getRuntime().freeMemory(), System.currentTimeMillis(), (int) 
2551218188L );

        System.out.println( uuid );
    }
}

Hope this helps,
-Rick

Mime
View raw message