-
1. Re: Generate GUID
cbuckley Jun 30, 2004 7:07 PM (in response to g00se)What is the id being used for (Primary key in DB)? Than how are you accessing the db straight jdbc or something else like CMP or Hibernate? JBoss has built in facilities to generate UUID's.
-
2. Re: Generate GUID
cbuckley Jun 30, 2004 7:08 PM (in response to g00se)Oh yeah probably not the best place for this post. Sorry.
-
3. Re: Generate GUID
g00se Jul 2, 2004 5:58 PM (in response to g00se)>>What is the id being used for
Not sure sorry - i'm really asking the q on someone else's behalf!
>>Oh yeah probably not the best place for this post. Sorry.
What would a better one be? -
4. Re: Generate GUID
gorano Jul 3, 2004 11:30 AM (in response to g00se)If you want a home made solution, you can always create a UUID table in your database.
Create one field with the name and one field with
value.
You can implement a cmp, bmp or session bean to read the table, increase value and update.
By creating a generic interface and a factory class you can make several implementations. You can for example take advantage of Oracle sequences in one of your implementations.
Generic methods could be:
getValue(String name);
getNextValue(String name);
setValue(String name, int val);
e.t.c.
This can be a nice solution, but it will of course
give a certain overhead you should be aware of.
By looking up Ids in the beginning of a transaction you can create nice asynchronous B2B solutions that can handle a very high temporary load (preliminary check of request data and id sent back as transaction id for later reference).
/Goran