Originally posted by pankaj semwal: Hi, Can any body write the code for doing this.
Please be aware that JavaRanch is NotACodeMill. What have you tried? Have you read the Oracle documentation on sequences? Have you googled for "primary key generation patterns"? Have you read the javaDocs for java.lang.UUID and considered the downsides of using this with a database? [ November 26, 2008: Message edited by: Paul Sturrock ]
if you don't want to be database dependant (don't want to use oracle sequences) but need the id to be cross application, there is the old fasioned sequences_table solution where you have a table and each row in the table contains: the table that needs an id, and the next available id for that row. you then simply selelct that value, add 1 and insert it back. (obviously locking the row before doing this)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com